[Assorted-commits] SF.net SVN: assorted: [319] sandbox/trunk/src/py/subprocesses.py
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-04 19:02:53
|
Revision: 319 http://assorted.svn.sourceforge.net/assorted/?rev=319&view=rev Author: yangzhang Date: 2008-02-04 11:02:59 -0800 (Mon, 04 Feb 2008) Log Message: ----------- added py subproc test Added Paths: ----------- sandbox/trunk/src/py/subprocesses.py Added: sandbox/trunk/src/py/subprocesses.py =================================================================== --- sandbox/trunk/src/py/subprocesses.py (rev 0) +++ sandbox/trunk/src/py/subprocesses.py 2008-02-04 19:02:59 UTC (rev 319) @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# vim:et:sw=2:ts=2 + +# Try passing something as an arg, causing us to exit immediately without +# waiting for the subprocess to finish; notice the subproc lives. + +# Try launching this (without args) in bg and killing it; notice subproc lives. + +# Try ctrl-c on this and wait; notice the subproc dies. + +# Try ctrl-c on this, then c-z, bg, ps; notice the subproc is defunct. + +# Try launching this in bg and kill -s sigint on it; notice the subproc lives. + +from subprocess import * +from sys import * +from time import * + +p = Popen(['sleep','5']) +if len(argv) == 1: + try: p.wait() + except KeyboardInterrupt: print p.poll() + sleep(10) Property changes on: sandbox/trunk/src/py/subprocesses.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |