Actually return when reading file failed

Fixes #8258.
This commit is contained in:
Fabian Homborg 2021-08-29 08:34:57 +02:00
parent 498e5fa9b0
commit 4c3cb119fc
2 changed files with 5 additions and 0 deletions

View File

@ -4227,6 +4227,7 @@ static int read_ni(parser_t &parser, int fd, const io_chain_t &io) {
FLOGF(error, _(L"Unable to read input file: %s"), strerror(err));
// Reset buffer on error. We won't evaluate incomplete files.
fd_contents.clear();
return 1;
}
}
}

View File

@ -90,3 +90,7 @@ $fish --no-config -c 'echo $$ oh no syntax error' -c 'echo this works'
# CHECKERR: fish: $$ is not the pid. In fish, please use $fish_pid.
# CHECKERR: echo $$ oh no syntax error
# CHECKERR: ^
$fish --no-config .
# CHECKERR: error: Unable to read input file: Is a directory
# CHECKERR: warning: Error while reading file .