Make sure 'become' process is given a proper tty device

pull/3306/head
Junegunn Choi 1 year ago
parent 86e4f4a841
commit 16b0aeda7d
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

@ -2961,6 +2961,14 @@ func (t *Terminal) Loop() {
if t.history != nil {
t.history.append(string(t.input))
}
/*
FIXME: It is not at all clear why this is required.
The following command will report 'not a tty', unless we open
/dev/tty *twice* after closing the standard input for 'reload'
in Reader.terminate().
: | fzf --bind 'start:reload:ls' --bind 'enter:become:tty'
*/
tui.TtyIn()
util.SetStdin(tui.TtyIn())
syscall.Exec(shellPath, []string{shell, "-c", command}, os.Environ())
}

@ -2921,6 +2921,11 @@ class TestGoFZF < TestBase
OUTPUT
tmux.until { assert_block(expected, _1) }
end
def test_become_tty
tmux.send_keys "sleep 0.5 | #{FZF} --bind 'start:reload:ls' --bind 'load:become:tty'", :Enter
tmux.until { |lines| assert_includes lines, '/dev/tty' }
end
end
module TestShell

Loading…
Cancel
Save