File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 98
98
[ :SIGINT , :SIGTERM ] . each do |signal |
99
99
trap ( signal ) do
100
100
SUBPROCESSES . each do |pid |
101
- puts "\n Sending #{ signal } to process #{ pid } "
102
- begin
103
- Process . kill ( signal , pid )
104
- rescue Errno ::ESRCH
105
- # Already killed
106
- end
101
+ Utilities . send_signal ( signal , pid )
107
102
end
108
103
# Keep running jt which will wait for the subprocesses termination
109
104
end
@@ -137,6 +132,17 @@ def jvmci_update_and_version
137
132
[ update , jvmci ]
138
133
end
139
134
135
+ def send_signal ( signal , pid )
136
+ STDERR . puts "\n Sending #{ signal } to process #{ pid } "
137
+ begin
138
+ Process . kill ( signal , pid )
139
+ rescue Errno ::ESRCH
140
+ # Already killed
141
+ nil
142
+ end
143
+ end
144
+ module_function :send_signal
145
+
140
146
def which ( binary )
141
147
ENV [ "PATH" ] . split ( File ::PATH_SEPARATOR ) . each do |dir |
142
148
path = "#{ dir } /#{ binary } "
@@ -259,7 +265,10 @@ def raw_sh_with_timeout(timeout, pid)
259
265
yield
260
266
end
261
267
rescue Timeout ::Error
262
- Process . kill ( 'TERM' , pid )
268
+ if send_signal ( :SIGTERM , pid )
269
+ sleep 1
270
+ send_signal ( :SIGKILL , pid )
271
+ end
263
272
yield # Wait and read the pipe if capture: true
264
273
:timeout
265
274
end
You can’t perform that action at this time.
0 commit comments