Closed Bug 1387307 Opened 7 years ago Closed 7 years ago

Add FailedCommandError(message, exit_code) s.t. mach won't print a stack-trace

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jonasfj, Assigned: jonasfj)

Details

Attachments

(1 file)

Simply a way to communicate expected errors nicely without littering our code
with:
  print(...)
  sys.exit(1)

which makes it hard to reuse code for anything other than the command it was written for.
Attachment #8893638 - Flags: review?(gps)
Comment on attachment 8893638 [details]
Bug 1387307 - Add FailedCommandError to mach

https://reviewboard.mozilla.org/r/164740/#review170954

::: python/mach/mach/main.py:457
(Diff revision 1)
>              return Registrar._run_command_handler(handler, context=context,
>                  debug_command=args.debug_command, **vars(args.command_args))
>          except KeyboardInterrupt as ki:
>              raise ki
> +        except FailedCommandError as e:
> +            print(e.message, file=sys.stderr)

While stderr is arguably the correct destination, other error handling code in this file writes to stdout. So let's drop `file=sys.stderr` and write to stdout.
Attachment #8893638 - Flags: review?(gps) → review+
Assignee: nobody → jopsen
Keywords: checkin-needed
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f5a478a70af0
Add FailedCommandError to mach r=gps
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f5a478a70af0
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: