Re: subprocess confusion

2007-04-17 Thread Nick Craig-Wood
Tim Arnold <[EMAIL PROTECTED]> wrote: > Just discovered that my subprocess call with the preexec_fn wasn't doing > what I thought. > If 'machine' value is different than the current machine name, I want to > remsh the command to that machine, but obviously I misunderstood the > preexec_fn a

Re: subprocess confusion

2007-04-17 Thread Tim Arnold
"Nick Craig-Wood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold <[EMAIL PROTECTED]> wrote: >> Should I just put the remsh in the actual command instead of >> preexec_fn? > > Yes. > > The preexec_fn is run after the fork() but before the exec(). Ie a > new process has

Re: subprocess confusion

2007-04-16 Thread Michael Hoffman
Tim Arnold wrote: > If 'machine' value is different than the current machine name, I want to > remsh the command to that machine, but obviously I misunderstood the > preexec_fn arg. I don't think the return value of preexec_fn is used for anything. You can use to do things like set process gro

subprocess confusion

2007-04-16 Thread Tim Arnold
Hi, Just discovered that my subprocess call with the preexec_fn wasn't doing what I thought. If 'machine' value is different than the current machine name, I want to remsh the command to that machine, but obviously I misunderstood the preexec_fn arg. Should I just put the remsh in the actual co

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >Cameron Laird wrote: > >> Your interactive session does indeed exhibit the behavior that >> puzzles me. My expectation was that StringIO and the std* >> parameters to Popen() were made for each other; certainly there >> ar

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Fredrik Lundh
Cameron Laird wrote: > Your interactive session does indeed exhibit the behavior that > puzzles me. My expectation was that StringIO and the std* > parameters to Popen() were made for each other; certainly there > are many cases where stdout and stderr can be redirected *to* a > StringIO. Is it

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Laurent Pointal
Cameron Laird a écrit : > In article <[EMAIL PROTECTED]>, > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >>> On Thu, 17 Aug 2006 17:16:25 +, [EMAIL PROTECTED] (Cameron Laird) >>> declaimed the following in comp.lang.python: >>> Question: >>>

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> On Thu, 17 Aug 2006 17:16:25 +, [EMAIL PROTECTED] (Cameron Laird) >> declaimed the following in comp.lang.python: >> >> > Question: >> > import subprocess, StringIO

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Nick Craig-Wood
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 17 Aug 2006 17:16:25 +, [EMAIL PROTECTED] (Cameron Laird) > declaimed the following in comp.lang.python: > > > Question: > > import subprocess, StringIO > > > > input = StringIO.StringIO("abcdefgh\nabc\n") > > Here you overri

Subprocess confusion: how file-like must stdin be?

2006-08-17 Thread Cameron Laird
Question: import subprocess, StringIO input = StringIO.StringIO("abcdefgh\nabc\n") # I don't know of a compact, evocative, and # cross-platform way to exhibit this behavior. # For now, depend on cat(1). p = subprocess.Popen(["cat"], stdout = subprocess.PIPE,