subprocess confusion

Nick Craig-Wood nick at
Tue Apr 17 16:30:07 CEST 2007

Tim Arnold <tiarno at> 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 arg.
>  Should I just put the remsh in the actual command instead of
>  preexec_fn?


The preexec_fn is run after the fork() but before the exec().  Ie a
new process has been made, but it hasn't started your task yet.

For example a classic use of preexec_fn is


You seem to be thinking it is pre-pending something to your command
line which isn't how it works.

Nick Craig-Wood <nick at> --

More information about the Python-list mailing list