| 141 |
Kevin |
1 |
#!/usr/bin/python
|
|
|
2 |
#
|
|
|
3 |
# Block header comment
|
|
|
4 |
#
|
|
|
5 |
#
|
|
|
6 |
import sys, imp, atexit
|
|
|
7 |
sys.path.append("/home/courses/cs3214/software/pexpect-dpty/");
|
|
|
8 |
import pexpect, shellio, signal, time, os, re, proc_check
|
|
|
9 |
|
|
|
10 |
#Ensure the shell process is terminated
|
|
|
11 |
def force_shell_termination(shell_process):
|
|
|
12 |
c.close(force=True)
|
|
|
13 |
|
|
|
14 |
#pulling in the regular expression and other definitions
|
|
|
15 |
definitions_scriptname = sys.argv[1]
|
|
|
16 |
plugin_dir = sys.argv[2]
|
|
|
17 |
def_module = imp.load_source('', definitions_scriptname)
|
|
|
18 |
logfile = None
|
|
|
19 |
if hasattr(def_module, 'logfile'):
|
|
|
20 |
logfile = def_module.logfile
|
|
|
21 |
|
|
|
22 |
#spawn an instance of the shell
|
|
|
23 |
c = pexpect.spawn(def_module.shell + plugin_dir, drainpty=True, logfile=logfile)
|
|
|
24 |
|
|
|
25 |
atexit.register(force_shell_termination, shell_process=c)
|
|
|
26 |
|
|
|
27 |
assert 1 == 0, "Unimplemented functionality"
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
shellio.success()
|