Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Greg Ewing
Nathaniel Smith wrote: On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing wrote: output(args) --> (status, output) Isn't this already available as: run(args, stdout=PIPE)? Yes, but you need to do more than that to get the output as a string. This is the relevant part of the implementation of

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Nathaniel Smith
On Thu, Apr 4, 2019 at 1:59 AM Greg Ewing wrote: > > Nathaniel Smith wrote: > > On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing > > wrote: > >>output(args) --> (status, output) > > > > Isn't this already available as: run(args, stdout=PIPE)? > > Yes, but you need to do more than that to get the

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Oleg Broytman
On Thu, Apr 04, 2019 at 07:44:29PM +1100, Chris Angelico wrote: > On Thu, Apr 4, 2019 at 7:12 PM Nathaniel Smith wrote: > > > > On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing > > wrote: > > > > > > The check_output() function of the subprocess module raises an > > > exception if the process

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Chris Angelico
On Thu, Apr 4, 2019 at 8:02 PM Greg Ewing wrote: > > Chris Angelico wrote: > > +1 on adding a nice simple function, although I'm not 100% sold on the > > name "output". > > The idea is that output/check_output would go together like > call/check_call. > Yeah, so I think that on balance it's

[Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Greg Ewing
The check_output() function of the subprocess module raises an exception if the process returns a non-zero exit status. This is inconvenient for commands such as grep that use the return status to indicate something other than success or failure. The check_call() function has a companion call(),

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Serhiy Storchaka
04.04.19 11:59, Greg Ewing пише: Nathaniel Smith wrote: On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing wrote: output(args) --> (status, output) Isn't this already available as: run(args, stdout=PIPE)? Yes, but you need to do more than that to get the output as a string. This is the relevant

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Nathaniel Smith
On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing wrote: > > The check_output() function of the subprocess module raises an > exception if the process returns a non-zero exit status. This is > inconvenient for commands such as grep that use the return > status to indicate something other than success or

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Chris Angelico
On Thu, Apr 4, 2019 at 7:12 PM Nathaniel Smith wrote: > > On Thu, Apr 4, 2019 at 12:48 AM Greg Ewing > wrote: > > > > The check_output() function of the subprocess module raises an > > exception if the process returns a non-zero exit status. This is > > inconvenient for commands such as grep

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Greg Ewing
Chris Angelico wrote: +1 on adding a nice simple function, although I'm not 100% sold on the name "output". The idea is that output/check_output would go together like call/check_call. -- Greg ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Guido van Rossum
Let’s please leave this alone. As Serhiy says run() covers everything. On Thu, Apr 4, 2019 at 3:03 AM Oleg Broytman wrote: > On Thu, Apr 04, 2019 at 07:44:29PM +1100, Chris Angelico > wrote: > > On Thu, Apr 4, 2019 at 7:12 PM Nathaniel Smith wrote: > > > > > > On Thu, Apr 4, 2019 at 12:48 AM