@@ -42,22 +42,22 @@ def get_pid_by_name(name):
42
42
# XXX: make sure this is restricted to subprocesses under us.
43
43
# This could be problematic on the continuous build if many tests are running
44
44
# in parallel.
45
- output = pexpect .run ('pgrep --exact --newest %s' % name )
45
+ output = pexpect .run ('pgrep --exact --newest cat' )
46
46
return int (output .split ()[- 1 ])
47
47
48
48
49
- def send_signal (name , sig_num ):
50
- """Kill the most recent process matching `name`."""
51
- os .kill (get_pid_by_name (name ), sig_num )
52
-
53
-
54
49
# XXX: osh.sendcontrol("z") does not suspend the foreground process :(
55
50
#
56
51
# why does osh.sendcontrol("c") generate SIGINT, while osh.sendcontrol("z")
57
52
# appears to do nothing?
58
53
def stop_process__hack (name ):
59
54
"""Send sigstop to the most recent process matching `name`"""
60
- send_signal (name , signal .SIGSTOP )
55
+ os .kill (get_pid_by_name (name ), signal .SIGSTOP )
56
+
57
+
58
+ def kill_process (name ):
59
+ """Kill the most recent process matching `name`."""
60
+ os .kill (get_pid_by_name (name ), signal .SIGINT )
61
61
62
62
63
63
class InteractiveTest (object ):
@@ -119,22 +119,6 @@ def __exit__(self, t, v, tb):
119
119
120
120
121
121
def main (argv ):
122
- with InteractiveTest ('wait builtin then SIGWINCH (issue 1067)' ) as osh :
123
- osh .sendline ('sleep 1 &' )
124
- osh .sendline ('wait' )
125
-
126
- time .sleep (0.1 )
127
-
128
- # simulate window size change
129
- osh .kill (signal .SIGWINCH )
130
-
131
- osh .expect (r'.*\$' ) # expect prompt
132
-
133
- osh .sendline ('echo status=$?' )
134
- osh .expect ('status=0' )
135
-
136
- #return
137
-
138
122
with InteractiveTest ('Ctrl-C during external command' ) as osh :
139
123
osh .sendline ('sleep 5' )
140
124
@@ -217,7 +201,7 @@ def main(argv):
217
201
osh .expect (r".*\$" )
218
202
osh .sendline ("fg" )
219
203
osh .expect (r"Continue PID \d+" )
220
- send_signal ("cat" , signal . SIGINT )
204
+ kill_process ("cat" )
221
205
osh .expect (r".*\$" )
222
206
osh .sendline ("fg" )
223
207
osh .expect ("No job to put in the foreground" )
0 commit comments