On 15/03/2022 08:18, Pasam Soujanya1 wrote:
I tried "tar" with a target that does not exist, and the tar file got
created successfully (with an error message about the missing file)
and with the exit code 0 (success). Same behavior is seen with JDK8
jar too. From JDK11 onward, the output jar isn't created and the exit
code is 1(failure).
So, to summarise: "jar" from Java 8 seems to be on the lines of "tar".
Do we want to continue with this "jar" behaviour which is not the same
as "tar" ?
The behavior since JDK 9 is to delete the temporary file when there is
an error. This looks to be the correct behavior. If it were changed back
then people would complain that jar is leaving files behind when it fails.
I'm curious how you run into this. Is this a script that runs with +e or
doesn't check the exit status?
-Alan