return codes from os.spawn

Discussion in 'Python' started by Nirmal, Sep 17, 2007.

  1. Nirmal

    Nirmal Guest

    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
    Nirmal, Sep 17, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derek Basch
    Replies:
    2
    Views:
    1,284
    Donn Cave
    Jan 21, 2005
  2. Replies:
    2
    Views:
    2,793
    Malcolm
    Aug 20, 2005
  3. Gabriel Genellina

    Re: return codes from os.spawn

    Gabriel Genellina, Sep 17, 2007, in forum: Python
    Replies:
    0
    Views:
    455
    Gabriel Genellina
    Sep 17, 2007
  4. Ed Hames
    Replies:
    0
    Views:
    362
    Ed Hames
    Apr 16, 2008
  5. Edgardo Hames
    Replies:
    1
    Views:
    332
    Ed Hames
    May 6, 2008
Loading...

Share This Page