subprocess executing shell
tim.arnold at sas.com
Thu Oct 22 18:28:45 CEST 2009
"Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> wrote in message
news:mailman.1840.1256202325.2807.python-list at python.org...
> En Wed, 21 Oct 2009 12:24:37 -0300, Tim Arnold <tim.arnold at sas.com>
>> Hi, I'm writing a script to capture a command on the commandline and run
>> on a remote server.
>> I guess I don't understand subprocess because the code below exec's the
>> user's .cshrc file even though by default shell=False in the Popen call.
> Do you mean it execs the .cshrc file in your *local* system or the
> *remote* one?
> Popen controls what happens on the local system only.
>> action.insert(0,'rsh my_remotehost')
>> p = subprocess.Popen(shlex.split(' '.join(action)))
>> Since the shell is executing in the child process anyway, is the only
>> difference when using shell=True is that environment variables can be
>> expanded in the command to be executed?
> Note that in this case, "the child process" is rsh on the local system.
> Popen has no control over what happens once rsh starts.
> Gabriel Genellina
Thanks, I see my mistake now. Arggg, I keep forgetting that one.
More information about the Python-list