os.spawn

hao-nghi.au at fr.thalesgroup.com hao-nghi.au at fr.thalesgroup.com
Wed Sep 12 12:41:56 EDT 2001


Hi Sylvain,

when you use os.P_NOWAIT, you get the pid of the process. Perhaps you can
get its return status by waitpid().

Regards,
Hao-Nghi Au

-----Original Message-----
From: syt at pegasus.logilab.fr [mailto:syt at pegasus.logilab.fr]
Sent: Wednesday, September 12, 2001 3:33 PM
To: python-list at python.org
Subject: Re: os.spawn


On Wed, 12 Sep 2001 09:13:58, S. Thenault <syt at pegasus.logilab.fr> wrote:
>On 11 Sep 2001 18:05:13 GMT, Donn Cave <donn at u.washington.edu> wrote:
>>Quoth syt at pegasus.logilab.fr (Sylvain Thenault):
>>
>>| how can I do for knowing what happend when I do an os.spawnv()
>>|
>>| for example, if i do
>>|
>>| import os
>>| os.spawnv(P_WAIT, '/bin/echo', 'this is a spawn test')
>>|
>>| I can't see anything, and don't know what have been made...
>>
>>Normal return from os.spawnv should be 0.  Anything else indicates
>>failure.
>>
>>   >>> print os.spawnv.__doc__
>>   spawnv(mode, file, args) -> integer
>>
>>   Execute file with arguments from args in a subprocess.
>>
>>Args here should be a tuple or list like sys.argv:
>>   os.spawnv(os.P_WAIT, '/bin/echo', ('echo', 'this is a spawn test'))
>>
>>	Donn Cave, donn at u.washington.edu
>
>thanks, i was waiting for an exception in case of error 
>does someone know why it isn't the default behaviour ?
>
>BTW, this wasn't working because as exec*, the first item of args must be 
>the called program's name ('echo' in this example)
as you said (i read your message too fast, didn't see you said that yet)

I have now another problem, I change P_WAIT to P_NOWAIT and spawnv return 
an integer != 0 either if spawnv succeed !

how to know if there is an error durring spawn with the P_NOWAIT flag?

-- 
Sylvain Thenault

LOGILAB

-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list