On Sunday 09 May 2004 13:04, Dirk Meyer wrote:
> Nicolas Michaux wrote:
> > 2) when you call popen2 class (and others) with commands in pileline,
> > python spawns a child with a shell to start multiple jobs for your pipes
> > : you lose the pid of these jobs and can't kill them later.
> > I found a workaround by setting the shell child a process group leader. I
> > add this line in util.popen3 in Popen4 class in _run_child function :
> > "os.setpgid(0, os.getpid())". Now you can kill the whole process tree by
> > calling os.kill(-child.pid, signal).
>
> It should also work if you use lists and not a string for starting the
> command: using "program arg1 arg2" should start a subshell,
> ["program", 'arg1", "arg2" ] should not.
>
>
> Dischi

Yes, I found this undocumented feature too, but it doesn't work with pipeline 
commands... It takes the pipe as an argument of the command and the command 
failed... 

I tried :

["program1", "arg1", "|", "program2", "arg2"]
["program1", "arg1 |", "program2", "arg2"]
["program1", "arg1", "| program2", "arg2"]
["program1", "arg1", "| program2 arg2"]

Nothing works as expected... 
In this case, who spawns the program2 if there is no shell?

I know I wouln't use pipeline commands in python, but it's a lot easier to 
manage in my case...(I have a lot of pipelines to handle)


Thanks for your answer,

Nicolas.


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Freevo-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to