Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alt-src should log exit code when command fails #19

Closed
rohanpm opened this issue Feb 5, 2020 · 1 comment
Closed

alt-src should log exit code when command fails #19

rohanpm opened this issue Feb 5, 2020 · 1 comment

Comments

@rohanpm
Copy link
Member

rohanpm commented Feb 5, 2020

Currently, when alt-src runs a command and it fails, the exit code of the command is never logged:

# in log_cmd

        for i in range(1, tries+1):
            proc = subprocess.Popen(cmd, **kwargs)
            ret = proc.wait()
            if not ret:
                return ret
            elif ret and i < tries:
                sleep_time = i * 30
                fmt = ' Command %s failed, will retry in %ss [tried: %s/%s]'
                self.logger.warn(fmt, ' '.join(cmd), sleep_time, i, tries)
                time.sleep(sleep_time)
        if ret:
            if fatal:
                raise CommandError, "command failed: %r" % cmd
            #otherwise
            self.logger.warn("Command failed: %r", cmd)
        return ret

See that ret is not included in the log messages here. (The callers of log_cmd also don't log it.)

It would be better if the exit code was logged here. Many tools communicate useful info through their exit codes, which can be useful in debugging failures. For example, see "man rsync" where the meaning of each exit code is listed.

@rbikar
Copy link
Member

rbikar commented Jun 11, 2020

@rbikar rbikar closed this as completed Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants