1 https://github.com/fish-shell/fish-shell/commit/5dc78dd858c28dcfd564ee50e56ccd33fc0b39dc
3 fix regression involving `read` from scripts
5 diff --git a/src/input.cpp b/src/input.cpp
6 index 1cdb151b3..d4dc16698 100644
9 @@ -189,7 +189,7 @@ static std::vector<terminfo_mapping_t> terminfo_mappings;
10 /// List of all terminfo mappings.
11 static std::vector<terminfo_mapping_t> mappings;
13 -/// Set to true when the input subsytem has been initialized.
14 +/// Set to true when the input subsystem has been initialized.
15 bool input_initialized = false;
17 /// Initialize terminfo.
18 @@ -307,7 +307,6 @@ void init_input() {
21 input_initialized = true;
25 void input_destroy() {
26 diff --git a/src/reader.cpp b/src/reader.cpp
27 index bd278ad6a..1e0e05698 100644
30 @@ -1563,10 +1563,10 @@ static bool check_for_orphaned_process(unsigned long loop_count, pid_t shell_pgi
32 /// Initialize data for interactive use.
33 static void reader_interactive_init() {
34 - assert(input_initialized);
35 // See if we are running interactively.
38 + if (!input_initialized) init_input();
40 shell_pgid = getpgrp();
42 diff --git a/tests/read.in b/tests/read.in
43 index febc2968f..0fe31ec01 100644
46 @@ -191,3 +191,6 @@ end
47 if test (string length "$x") -ne $FISH_READ_BYTE_LIMIT
48 echo reading the max amount of data with --nchars failed the length test
51 +echo '# Confirm reading non-interactively works (#4206 regression)'
52 +echo abc\ndef | ../test/root/bin/fish -i -c 'read a; read b; show $a; show $b'
53 diff --git a/tests/read.out b/tests/read.out
54 index d35a9146a..88b445a40 100644
57 @@ -58,3 +58,8 @@ newline
60 Chunked reads test pass
61 +# Confirm reading non-interactively works (#4206 regression)