connect stdin of external commands to the terminal
Without Stdin, commands read from /dev/null, so interactive programs like 'sudo su -', vim or ssh got EOF right away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b8f06ea6d
commit
03e791cbcd
2 files changed
+37
-2
No files matched your search
@@ -760,9 +760,13 @@ Features:
|
||||
// Prepare the command to execute.
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
|
||||
// Set the correct output device.
|
||||
cmd.Stderr = os.Stderr
|
||||
// Connect the command to the terminal. Without Stdin the command would
|
||||
// read from /dev/null, so interactive programs (su, vim, ssh, ...) would
|
||||
// get EOF right away. readline only reads from stdin while a line is
|
||||
// being edited, so it does not steal input from the command.
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
// Execute the command return the error.
|
||||
return cmd.Run()
|
||||
|
||||
Reference in new issue
Block a user