aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2015-12-14 17:21:43 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-12-15 23:40:53 -0800
commitc68f8f34182998ba8d2b46a5ffeef8d13dd79231 (patch)
tree773e12dc446c18ec16548bd6dcac65d6107eab1a /src
parentaa5291c6bd1ec7ee30d03a98e0114184fe2a873c (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/exec.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/exec.cpp b/src/exec.cpp
index bd9f9fb5..fa58c310 100644
--- a/src/exec.cpp
+++ b/src/exec.cpp
@@ -45,6 +45,7 @@
#include "parse_util.h"
#include "io.h"
#include "parse_tree.h"
+#include "reader.h"
/**
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)
{
@@ -266,6 +268,8 @@ static void launch_process_nofork(process_t *p)
const char *const *envv = env_export_arr(false);
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. */
safe_launch_process(p, actual_cmd, argv_array.get(), envv);
}