[Python-ideas] Add subprocess.Popen suspend() and resume()

Antoine Pitrou solipsis at pitrou.net
Mon Mar 18 11:46:34 EDT 2019


Seems reasonable to me.

Regards

Antoine.


On Mon, 18 Mar 2019 16:41:34 +0100
"Giampaolo Rodola'" <g.rodola at gmail.com>
wrote:
> Hello,
> I've been having these 2 implemented in psutil for a long time. On
> POSIX these are convenience functions using os.kill() + SIGSTOP /
> SIGCONT (the same as CTRL+Z  / "fg"). On Windows they use undocumented
> NtSuspendProcess and NtResumeProcess Windows APIs available since XP.
> The same approach is used by ProcessHacker and - I suppose -
> pssupend.exe, both from Sysinternals team. It must be noted that there
> are 3 different ways to do this on Windows
> (https://stackoverflow.com/a/11010508/376587) but
> NtSuspend/ResumeProcess appears to be the best choice. Possible use
> case:
> 
> <<PsSuspend lets you suspend processes on the local or a remote
> system, which is desirable in cases where a process is consuming a
> resource (e.g. network, CPU or disk) that you want to allow different
> processes to use. Rather than kill the process that's consuming the
> resource, suspending permits you to let it continue operation at some
> later point in time.>>
> 
> Thoughts?
> 





More information about the Python-ideas mailing list