-
-
Notifications
You must be signed in to change notification settings - Fork 910
Exit code 0 on failure #1190
Copy link
Copy link
Closed
Labels
Milestone
Description
In certain scenarios, error state produces an exit code 0, which makes it hard to write scripts with proper error handling.
In particular, if access to the destination path is denied, s3cmd would fail with exit code 0:
C:\Users\bazzilic> wsl s3cmd get s3://XXX/abc.plt /d/abc/abc.plt
ERROR: Skipping /d/abc/abc.plt: Permission denied
C:\Users\bazzilic> $LASTEXITCODE
0
This is not a WSL quirk, in other instances there is a proper exit code on error:
C:\Users\bazzilic> wsl s3cmd asdflkj asdlkfjh
ERROR: Invalid command: asdflkj
C:\Users\bazzilic> $LASTEXITCODE
64
Version of s3cmd:
C:\Users\bazzilic> wsl s3cmd --version
s3cmd version 2.0.2
Reactions are currently unavailable