summaryrefslogtreecommitdiff
path: root/pexpect/tests/test_killed_pid.py
blob: ff2fe5e48f7156257838f8a74aad6873cfef3b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python
import os, time, signal
import expyct

e = expyct.expyct ('/bin/sh', '-i')
print 'pid,fd:', e.pid, e.fd
print 'isAlive:', e.isAlive()
# Treat it brusquely.
print 'sending SIGKILL...'
os.kill (e.pid, signal.SIGKILL)
time.sleep (1)
print os.read(e.fd, 1000)
print 'isAlive:', e.isAlive()
e.expect('\#')
e.send ('ls -la /\n')
r,m,i = e.expect ('\#')
print r