Closed Bug 791383 Opened 12 years ago Closed 6 years ago

[mozprocess] mozprocess methods that behaves like subprocess.call/check_call but in the manner we want to do this

Categories

(Testing :: Mozbase, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: k0scist, Unassigned)

References

Details

I often find myself writing scripts that call a bunch of subprocesses
where I generally want:

- if the program finishes successfully, don't output the subprocess
  stdout/stderr (unless, perhaps, a --verbose flag is given)
BUT...if the subprocess fails:
- I want to print the process's exit code and the command line (etc)
- I want to print the process's stdout and stderr
- I want to sys.exit(something), where something is probably the exit
  code of the process

Again, it would be nice to have this in a place i could use it, at
least in m-c though potentially elsewhere.

One way of doing this:

- have one method that front-ends subprocess.Popen that returns a
  tuple of (exit_code, stdout, stderr)

- have another method that calls the first that provides the sort of
  functionality I provide above (that is, is silent by default, but on
  exit_code != 1 printing out "all the things" and exiting the
  program)

I'm not sure if mozprocess is the right place for this, but I can't
think of anything better, tbh.  Whether it should actually use
mozprocess.processhandler...I'm also not sure :)

In any case, not a huge priority, but a nice to have.
Severity: normal → enhancement
See Also: → 819547
Summary: mozprocess(?) methods that behaves like subprocess.call/check_call but in the manner we want to do this → [mozprocess] mozprocess methods that behaves like subprocess.call/check_call but in the manner we want to do this
see also https://bugzilla.mozilla.org/show_bug.cgi?id=746243#c34

> - [mozprocess] call convenience method I added to runttests.py
> should be upstreamed:
> https://bugzilla.mozilla.org/show_bug.cgi?id=791383
Mass closing bugs with no activity in 2+ years. If this bug is important to you, please re-open.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.