Created
June 7, 2011 21:44
-
-
Save ananelson/1013246 to your computer and use it in GitHub Desktop.
script to demonstrate jython/pexpect zombie on OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Minimal example of jython -i causing zombie processes when called via pexpect. | |
import pexpect | |
EXECUTABLE = 'jython -i' | |
PROMPT = '>>>|\.\.\.' # Python uses >>> prompt normally and ... when in multi-line structures like loops | |
proc = pexpect.spawn(EXECUTABLE) | |
proc.expect(PROMPT) | |
print "==================================================" | |
print proc.before | |
try: | |
proc.close() | |
except pexpect.ExceptionPexpect: | |
print "process %s may not have closed" % proc.pid | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment