Merge pull request #15255 from reitermarkus/open3-tty-width
Pass TTY width to `Open3`.
This commit is contained in:
commit
434f897717
@ -197,10 +197,13 @@ class SystemCommand
|
|||||||
}
|
}
|
||||||
options[:chdir] = chdir if chdir
|
options[:chdir] = chdir if chdir
|
||||||
|
|
||||||
pid = T.let(nil, T.nilable(Integer))
|
|
||||||
raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = ignore_interrupts do
|
raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = ignore_interrupts do
|
||||||
Open3.popen3(env, [executable, executable], *args, **options)
|
Open3.popen3(
|
||||||
.tap { |*, wait_thr| pid = wait_thr.pid }
|
env.merge({ "COLUMNS" => Tty.width.to_s }),
|
||||||
|
[executable, executable],
|
||||||
|
*args,
|
||||||
|
**options,
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
write_input_to(raw_stdin)
|
write_input_to(raw_stdin)
|
||||||
@ -228,7 +231,7 @@ class SystemCommand
|
|||||||
thread_done_queue << true
|
thread_done_queue << true
|
||||||
line_thread.join
|
line_thread.join
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
Process.kill("INT", pid) if pid && !sudo?
|
Process.kill("INT", raw_wait_thr.pid) if raw_wait_thr && !sudo?
|
||||||
raise Interrupt
|
raise Interrupt
|
||||||
rescue SystemCallError => e
|
rescue SystemCallError => e
|
||||||
@status = $CHILD_STATUS
|
@status = $CHILD_STATUS
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user