mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
restore the terminal modes before an "exec"
When replacing the existing fish process with a new process it is important to restore the temrinal modes to what they were when fish started running. We don't want any tweaks done for the benefit of fish (e.g., disabling ICRNL mode) to bleed thru to an "exec"ed command. Resolves #2609
This commit is contained in:
parent
aa5291c6bd
commit
c68f8f3418
1 changed files with 5 additions and 1 deletions
|
@ -45,6 +45,7 @@
|
||||||
#include "parse_util.h"
|
#include "parse_util.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "parse_tree.h"
|
#include "parse_tree.h"
|
||||||
|
#include "reader.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
file descriptor redirection error message
|
file descriptor redirection error message
|
||||||
|
@ -253,7 +254,8 @@ static void safe_launch_process(process_t *p, const char *actual_cmd, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is similar to launch_process, except it is not called after a fork (i.e. it only calls exec) and therefore it can allocate memory.
|
This function is similar to launch_process, except it is not called after a
|
||||||
|
fork (i.e. it only calls exec) and therefore it can allocate memory.
|
||||||
*/
|
*/
|
||||||
static void launch_process_nofork(process_t *p)
|
static void launch_process_nofork(process_t *p)
|
||||||
{
|
{
|
||||||
|
@ -266,6 +268,8 @@ static void launch_process_nofork(process_t *p)
|
||||||
const char *const *envv = env_export_arr(false);
|
const char *const *envv = env_export_arr(false);
|
||||||
char *actual_cmd = wcs2str(p->actual_cmd.c_str());
|
char *actual_cmd = wcs2str(p->actual_cmd.c_str());
|
||||||
|
|
||||||
|
/* Ensure the terminal modes are what they were before we changed them. */
|
||||||
|
restore_term_mode();
|
||||||
/* Bounce to launch_process. This never returns. */
|
/* Bounce to launch_process. This never returns. */
|
||||||
safe_launch_process(p, actual_cmd, argv_array.get(), envv);
|
safe_launch_process(p, actual_cmd, argv_array.get(), envv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue