Merge lp://staging/~steve-mcintyre/linaro-chromiumos/error_checking into lp://staging/linaro-chromiumos

Proposed by Steve McIntyre
Status: Needs review
Proposed branch: lp://staging/~steve-mcintyre/linaro-chromiumos/error_checking
Merge into: lp://staging/linaro-chromiumos
Diff against target: 69 lines (+9/-7)
2 files modified
remote/run_build (+2/-1)
remote/setup_build (+7/-6)
To merge this branch: bzr merge lp://staging/~steve-mcintyre/linaro-chromiumos/error_checking
Reviewer Review Type Date Requested Status
Loïc Minier Pending
Review via email: mp+55578@code.staging.launchpad.net

Description of the change

Should have pushed this ages ago...

More error handling; make sure that we abort properly on errors.

To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote :

Remove the "print" before the exception throwing; you can either deal with the error in higher level logic, or print the exception message from the main script, or just let the exception go out to the default handler which will include the error message.

Usually in scripts people prefer the subprocess module rather than os.system() which is very limited; subprocess.Popen() is very flexible allowing you to do pipes or capture stdout / stderr for instance, and if you only need to run a command and throw an exception if it fails it provides a wrapper around Popen called check_call() which does that. There are other utilities to get command output as well.

I suggest you use check_call instead of os.system; this will allow closing stderr or stdout in the future when we deem sensible, or piping them to a log file etc.

Unmerged revisions

18. By Steve McIntyre

Better error-handling

Check for errors from os.system() calls and throw exceptions on
failure.
Throw exceptions rather than return errors from functions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches