Eliminate shell_is_interactive

We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
This commit is contained in:
ridiculousfish
2019-05-27 14:52:48 -07:00
parent 3f1d7bbdc5
commit 4a2c709fb1
20 changed files with 85 additions and 104 deletions

View File

@@ -29,6 +29,7 @@
#include "fish_version.h"
#include "input.h"
#include "input_common.h"
#include "parser.h"
#include "print_help.h"
#include "proc.h"
#include "reader.h"
@@ -285,9 +286,10 @@ static void setup_and_process_keys(bool continuous_mode) {
set_interactive_session(true); // by definition this program is interactive
set_main_thread();
setup_fork_guards();
proc_push_interactive(1);
env_init();
reader_init();
parser_t &parser = parser_t::principal_parser();
scoped_push<bool> interactive{&parser.libdata().is_interactive, true};
// We need to set the shell-modes for ICRNL,
// in fish-proper this is done once a command is run.
tcsetattr(STDIN_FILENO, TCSANOW, &shell_modes);