mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 05:12:50 +08:00
Update TTY modes for external commands only after successful command
According to the discussion in #2315, we adopt TTY modes for external commands mainly for "stty". If our child process crashes (or SSH disconnect), we might get weird modes. Let's ignore the modes in the failure case. Co-authored-by: Johannes Altmanninger <aclopte@gmail.com> Part of #10603
This commit is contained in:
parent
56a4ae17c9
commit
041a26f647
|
@ -155,6 +155,7 @@ Interactive improvements
|
|||
- ``read --help`` and friends no longer ignore redirections. This fixes a regression in version 3.1 (:issue:`10274`).
|
||||
- Measuring a command with ``time`` now considers the time taken for command substitution (:issue:`9100`).
|
||||
- ``fish_add_path`` now automatically enables verbose mode when used interactively (in the commandline), in an effort to be clearer about what it does (:issue:`10532`).
|
||||
- fish no longer adopts TTY modes of failed commands (:issue:`10603`).
|
||||
|
||||
New or improved bindings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -3680,8 +3680,10 @@ pub fn term_copy_modes() {
|
|||
}
|
||||
|
||||
/// Grab control of terminal.
|
||||
fn term_steal() {
|
||||
term_copy_modes();
|
||||
fn term_steal(copy_modes: bool) {
|
||||
if copy_modes {
|
||||
term_copy_modes();
|
||||
}
|
||||
while unsafe { libc::tcsetattr(STDIN_FILENO, TCSANOW, &*shell_modes()) } == -1 {
|
||||
if errno().0 == EIO {
|
||||
redirect_tty_output();
|
||||
|
@ -4986,7 +4988,7 @@ fn reader_run_command(parser: &Parser, cmd: &wstr) -> EvalRes {
|
|||
);
|
||||
}
|
||||
|
||||
term_steal();
|
||||
term_steal(eval_res.status.is_success());
|
||||
|
||||
// Provide value for `status current-command`
|
||||
parser.libdata_mut().status_vars.command = (*PROGRAM_NAME.get().unwrap()).to_owned();
|
||||
|
|
Loading…
Reference in New Issue
Block a user