Merge pull request #17835 from Homebrew/system_command-ebadf
system_command: fix EBADF on Ctrl+C
This commit is contained in:
commit
8e8ce4a2f7
@ -265,15 +265,16 @@ class SystemCommand
|
|||||||
raise Timeout::Error if raw_wait_thr.join(Utils::Timer.remaining(end_time)).nil?
|
raise Timeout::Error if raw_wait_thr.join(Utils::Timer.remaining(end_time)).nil?
|
||||||
|
|
||||||
@status = raw_wait_thr.value
|
@status = raw_wait_thr.value
|
||||||
|
|
||||||
thread_ready_queue.pop
|
|
||||||
line_thread.raise ProcessTerminatedInterrupt.new
|
|
||||||
thread_done_queue << true
|
|
||||||
line_thread.join
|
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
Process.kill("INT", raw_wait_thr.pid) if raw_wait_thr && !sudo?
|
Process.kill("INT", raw_wait_thr.pid) if raw_wait_thr && !sudo?
|
||||||
raise Interrupt
|
raise Interrupt
|
||||||
ensure
|
ensure
|
||||||
|
if line_thread
|
||||||
|
thread_ready_queue.pop
|
||||||
|
line_thread.raise ProcessTerminatedInterrupt.new
|
||||||
|
thread_done_queue << true
|
||||||
|
line_thread.join
|
||||||
|
end
|
||||||
raw_stdin&.close
|
raw_stdin&.close
|
||||||
raw_stdout&.close
|
raw_stdout&.close
|
||||||
raw_stderr&.close
|
raw_stderr&.close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user