From 4c3cb119fc465dcef24e7fc5113f068c79817359 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 29 Aug 2021 08:34:57 +0200 Subject: [PATCH] Actually return when reading file failed Fixes #8258. --- src/reader.cpp | 1 + tests/checks/invocation.fish | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/reader.cpp b/src/reader.cpp index 0c34ecc64..aa55d160b 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -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; } } } diff --git a/tests/checks/invocation.fish b/tests/checks/invocation.fish index 4460e4c2d..ab4db110c 100644 --- a/tests/checks/invocation.fish +++ b/tests/checks/invocation.fish @@ -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 .