On Fri, 2010-12-03 at 19:57 +0000, Martin Ohlsson wrote:
> >=== modified file 'media_create/cmd_runner.py'
> >--- media_create/cmd_runner.py 2010-12-01 19:08:25 +0000
> >+++ media_create/cmd_runner.py 2010-12-03 19:01:21 +0000
> >@@ -1,12 +1,13 @@
> > import subprocess
> >
> >-def run(args, as_root=False):
> >+def run(args, as_root=False, stdout=None):
>
> Would it be possible to add stdin as a parameter to this function so the output from one command can be connected to the input of another? E.g. check_device() connects several commands using a pipe.
I suppose that's possible, but I wonder if there is a real advantage in
running each of the commands individually and pipe their stdin/stdout in
Python, or would this be a case we'd be better off by letting the shell
do that (i.e. run them all as a single subprocess.call(...,
shell=True))?
>
> This implies also that stdout of the subprocess is returned in some way.
On Fri, 2010-12-03 at 19:57 +0000, Martin Ohlsson wrote: create/ cmd_runner. py' cmd_runner. py 2010-12-01 19:08:25 +0000 cmd_runner. py 2010-12-03 19:01:21 +0000
> >=== modified file 'media_
> >--- media_create/
> >+++ media_create/
> >@@ -1,12 +1,13 @@
> > import subprocess
> >
> >-def run(args, as_root=False):
> >+def run(args, as_root=False, stdout=None):
>
> Would it be possible to add stdin as a parameter to this function so the output from one command can be connected to the input of another? E.g. check_device() connects several commands using a pipe.
I suppose that's possible, but I wonder if there is a real advantage in call(.. .,
running each of the commands individually and pipe their stdin/stdout in
Python, or would this be a case we'd be better off by letting the shell
do that (i.e. run them all as a single subprocess.
shell=True))?
>
> This implies also that stdout of the subprocess is returned in some way.
I'm not sure I understand what you mean here.