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

V

Victor Hooi

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
 
N

Nobody

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().
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top