Support showing exit codes with --show-rc #89

Closed
opened 2018-08-19 17:54:25 +00:00 by varac · 5 comments

Please implement --show-rc to show the exit code of the borg commands.

https://borgbackup.readthedocs.io/en/stable/man_intro.html?highlight=rc#return-codes

Please implement `--show-rc` to show the exit code of the borg commands. https://borgbackup.readthedocs.io/en/stable/man_intro.html?highlight=rc#return-codes
Owner

Could you comment as to what you're using the exit codes for? For instance, if you're programmatically parsing the exit codes for some purpose, I want to make sure I don't prevent you from doing that even if this is implemented by interleaving borgmatic logs. Thanks!

Could you comment as to what you're using the exit codes for? For instance, if you're programmatically parsing the exit codes for some purpose, I want to make sure I don't prevent you from doing that even if this is implemented by interleaving borgmatic logs. Thanks!
Author

I was debugging my borgmatic systemd timer which failed each time because of a non-0 exit code. I wanted to look in the logs which code it was.

I was debugging my borgmatic systemd timer which failed each time because of a non-0 exit code. I wanted to look in the logs which code it was.
Owner

Got it, thanks. Do you think it would make sense to just always pass the --show-rc code to Borg when borgmatic's -v 2 verbosity option is specified? I'm suggesting that because it sounds like a debugging/verbosity aide.

Got it, thanks. Do you think it would make sense to just always pass the `--show-rc` code to Borg when borgmatic's `-v 2` verbosity option is specified? I'm suggesting that because it sounds like a debugging/verbosity aide.
Owner

I went ahead and implemented that. It'll be part of the next release. Note that even without this, I believe that borgmatic logs Borg's exit code in the case that Borg errors. Example:

# borgmatic --list -v 2
...
borg list: error: argument --lock-wait: invalid int value: 'invalid'
...
Command '('borg', 'list', 'user@remote', '--remote-path', 'borg1', '--debug', '--lock-wait', 'invalid', '--show-rc')' returned non-zero exit status 2
I went ahead and implemented that. It'll be part of the next release. Note that even without this, I believe that borgmatic logs Borg's exit code in the case that Borg errors. Example: ```shell # borgmatic --list -v 2 ... borg list: error: argument --lock-wait: invalid int value: 'invalid' ... Command '('borg', 'list', 'user@remote', '--remote-path', 'borg1', '--debug', '--lock-wait', 'invalid', '--show-rc')' returned non-zero exit status 2 ```
Owner

Released as part of borgmatic 1.2.3!

Released as part of borgmatic 1.2.3!
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#89