mirror of
https://github.com/junegunn/fzf.git
synced 2025-09-02 21:33:50 -07:00
Make sure 'become' process is given a proper tty device
This commit is contained in:
@@ -2961,6 +2961,14 @@ func (t *Terminal) Loop() {
|
|||||||
if t.history != nil {
|
if t.history != nil {
|
||||||
t.history.append(string(t.input))
|
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())
|
util.SetStdin(tui.TtyIn())
|
||||||
syscall.Exec(shellPath, []string{shell, "-c", command}, os.Environ())
|
syscall.Exec(shellPath, []string{shell, "-c", command}, os.Environ())
|
||||||
}
|
}
|
||||||
|
@@ -2921,6 +2921,11 @@ class TestGoFZF < TestBase
|
|||||||
OUTPUT
|
OUTPUT
|
||||||
tmux.until { assert_block(expected, _1) }
|
tmux.until { assert_block(expected, _1) }
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
module TestShell
|
module TestShell
|
||||||
|
Reference in New Issue
Block a user