summaryrefslogtreecommitdiff
path: root/bootstraptest/runner.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-07-09 13:01:44 +0900
committerNobuyoshi Nakada <[email protected]>2024-07-09 13:01:44 +0900
commit690b56440beaa32873a8311451033bb4bd34e94c (patch)
tree9b607e87c325231e3eb28a7e4e7c7deddbd01b42 /bootstraptest/runner.rb
parente500222de1a8d5e7a844209a7e912b03db8cdf76 (diff)
Use `File.write` instead of `Kernel#open`
Diffstat (limited to 'bootstraptest/runner.rb')
-rwxr-xr-xbootstraptest/runner.rb28
1 files changed, 12 insertions, 16 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index c0638ffc9a..2e2a3611de 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -704,23 +704,19 @@ def assert_normal_exit(testsrc, *rest, timeout: BT.timeout, **opt)
timeout_signaled = false
logfile = "assert_normal_exit.#{as.path}.#{as.lineno}.log"
- begin
- err = open(logfile, "w")
- io = IO.popen("#{BT.ruby} -W0 #{filename}", err: err)
- pid = io.pid
- th = Thread.new {
- io.read
- io.close
- $?
- }
- if !th.join(timeout)
- Process.kill :KILL, pid
- timeout_signaled = true
- end
- status = th.value
- ensure
- err.close
+ io = IO.popen("#{BT.ruby} -W0 #{filename}", err: logfile)
+ pid = io.pid
+ th = Thread.new {
+ io.read
+ io.close
+ $?
+ }
+ if !th.join(timeout)
+ Process.kill :KILL, pid
+ timeout_signaled = true
end
+ status = th.value
+
if status && status.signaled?
signo = status.termsig
signame = Signal.list.invert[signo]