Skip to content

Instantly share code, notes, and snippets.

@ananelson
Created June 7, 2011 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ananelson/1013246 to your computer and use it in GitHub Desktop.
Save ananelson/1013246 to your computer and use it in GitHub Desktop.
script to demonstrate jython/pexpect zombie on OSX
# 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