Spawn a process, then exit, whilst leaving process running?

Discussion in 'Python' started by Victor Hooi, Feb 9, 2013.

  1. Victor Hooi

    Victor Hooi Guest

    Hi,

    I have a Python script that I'd like to spawn a separate process (SSH client, in this case), and then have the script exit whilst the process continues to run.

    I looked at Subprocess, however, that leaves the script running, and it's more for spawning processes and then dealing with their output.

    Somebody mentioned multiprocessing, however, I'm not sure quite sure how that would work here.

    What's the most Pythontic way of achieving this purpose?

    Cheers,
    Victor
    Victor Hooi, Feb 9, 2013
    #1
    1. Advertising

  2. Victor Hooi

    Nobody Guest

    On Fri, 08 Feb 2013 21:04:33 -0800, Victor Hooi wrote:

    > I have a Python script that I'd like to spawn a separate process (SSH
    > client, in this case), and then have the script exit whilst the process
    > continues to run.
    >
    > I looked at Subprocess, however, that leaves the script running, and it's
    > more for spawning processes and then dealing with their output.
    >
    > Somebody mentioned multiprocessing, however, I'm not sure quite sure how
    > that would work here.
    >
    > What's the most Pythontic way of achieving this purpose?


    On Unix, the os.exec* functions might be appropriate, depending upon
    whether the script needs to do anything afterwards. Otherwise, use
    subprocess.Popen().
    Nobody, Feb 10, 2013
    #2
    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,279
    Donn Cave
    Jan 21, 2005
  2. Replies:
    0
    Views:
    252
  3. Ed Hames
    Replies:
    0
    Views:
    361
    Ed Hames
    Apr 16, 2008
  4. Edgardo Hames
    Replies:
    1
    Views:
    325
    Ed Hames
    May 6, 2008
  5. Kieran Benton
    Replies:
    1
    Views:
    270
    Christopher J. Hahn
    Jul 4, 2005
Loading...

Share This Page