Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this change?
According to rclone documentation, exit code 1 is for "syntax or usage" and 2 is for "not otherwise categorised" errors. However, in current implementation, exit code 2 will never be returned (*with one exception in bisync, see below), and in reality exit code 1 will be used for anything other than the "otherwise categorised" errors - exit code 1 is the default for unsuccessful returns.
There seem to be a more or less convention for exit codes in Linux/shell world, maybe some specifically for bash:
(https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html)
(https://www.redhat.com/sysadmin/exit-codes-demystified)
This PR does the following changes to exit codes from rclone:
rclone copy a
,rclone copy a b c
orrclone copy --unknownflag a b
.rclone unknowncommand
, or simplyrclone
, this now returns exit code 2 instead of 1.* bisync exception: There was actually one case of exit code 2, in bisync, where it explicitely called
os.Exit
without going throughresolveExitCode
. I added a commit to change that to exit code 7, more in-line with rest of rclone, and updated the description of exit codes in bisync documentation according to these changes affecting exit codes 1, 2 and 7.Was the change discussed in an issue or in the forum before?
https://forum.rclone.org/t/minor-bug-return-code-from-rclone-check/44236
Checklist