Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38499 > unrolled thread

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

Started byVictor Hooi <victorhooi@gmail.com>
First post2013-02-08 21:04 -0800
Last post2013-02-10 03:50 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Spawn a process, then exit, whilst leaving process running? Victor Hooi <victorhooi@gmail.com> - 2013-02-08 21:04 -0800
    Re: Spawn a process, then exit, whilst leaving process running? Nobody <nobody@nowhere.com> - 2013-02-10 03:50 +0000

#38499 — Spawn a process, then exit, whilst leaving process running?

FromVictor Hooi <victorhooi@gmail.com>
Date2013-02-08 21:04 -0800
SubjectSpawn a process, then exit, whilst leaving process running?
Message-ID<39ae6b0f-339e-4e50-8cb0-4c020c6aff76@googlegroups.com>
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

[toc] | [next] | [standalone]


#38547

FromNobody <nobody@nowhere.com>
Date2013-02-10 03:50 +0000
Message-ID<pan.2013.02.10.03.50.06.617000@nowhere.com>
In reply to#38499
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().

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web