return codes from os.spawn

Nirmal nirmaljs at lasonindia.com
Mon Sep 17 07:17:22 EDT 2007


Hi,

When I try running java through os.spawnv with P_NOWAIT,  it returns the
process id

>>> os.spawnv(os.P_NOWAIT, '$JAVA_HOME/bin', ('java', '$JAVA_HOME/bin/java
ex3178 true'))
19524

then I removed the command line parameter in the java command to fail ( it
should throw an exception)  the process and ran it. This time also it
returned the process id .

>>> os.spawnv(os.P_NOWAIT, '$JAVA_HOME/bin', ('java', '$JAVA_HOME/bin/java
ex3178'))
21947


And I tried the same by using P_WAIT  and it returned the same exit code

>>> os.spawnv(os.P_WAIT, '$JAVA_HOME/bin', ('java', '$JAVA_HOME/bin/java
ex3178 true))
127
>>> os.spawnv(os.P_WAIT, '$JAVA_HOME/bin', ('java', '$JAVA_HOME/bin/java
ex3178'))
127


please let me know how can we identify that the process is completed
successfully or not ?

Thanks,
Nirmal







More information about the Python-list mailing list