fix regression involving read from scripts

Fixes #4206
This commit is contained in:
Kurtis Rader 2017-07-15 21:21:24 -07:00
parent f2c8e73891
commit 5dc78dd858
5 changed files with 11 additions and 3 deletions

View file

@ -25,6 +25,7 @@
- `count -h` and `count --help` now return one rather than produce command help output (#4189).
- Fix setting `$COLUMNS` and `$LINES` before first prompt is displayed (#4141).
- `read` failures due to too much data should define the var (#4180).
- multiple `read` commands in non-interactive scripts were broken in fish 2.6.0 (#4206).
- Added completions for:
- `as` (#4130).
- `jest` (#4142).

View file

@ -189,7 +189,7 @@ static std::vector<terminfo_mapping_t> terminfo_mappings;
/// List of all terminfo mappings.
static std::vector<terminfo_mapping_t> mappings;
/// Set to true when the input subsytem has been initialized.
/// Set to true when the input subsystem has been initialized.
bool input_initialized = false;
/// Initialize terminfo.
@ -307,7 +307,6 @@ void init_input() {
}
input_initialized = true;
return;
}
void input_destroy() {

View file

@ -1563,10 +1563,10 @@ static bool check_for_orphaned_process(unsigned long loop_count, pid_t shell_pgi
/// Initialize data for interactive use.
static void reader_interactive_init() {
assert(input_initialized);
// See if we are running interactively.
pid_t shell_pgid;
if (!input_initialized) init_input();
kill_init();
shell_pgid = getpgrp();

View file

@ -191,3 +191,6 @@ end
if test (string length "$x") -ne $FISH_READ_BYTE_LIMIT
echo reading the max amount of data with --nchars failed the length test
end
echo '# Confirm reading non-interactively works (#4206 regression)'
echo abc\ndef | ../test/root/bin/fish -i -c 'read a; read b; show $a; show $b'

View file

@ -58,3 +58,8 @@ newline
# chunked read tests
Chunked reads test pass
# Confirm reading non-interactively works (#4206 regression)
count=1
|abc|
count=1
|def|