builtin.cpp: don't check exit code if not a normal exit

Fixes #8308
This commit is contained in:
Aaron Gyes 2021-09-21 17:45:18 -07:00
parent cedf9c4d90
commit b4b84f6847

View File

@ -158,7 +158,7 @@ void builtin_print_help(parser_t &parser, const io_streams_t &streams, const wch
ios.push_back(std::make_shared<io_fd_t>(STDOUT_FILENO, STDERR_FILENO)); ios.push_back(std::make_shared<io_fd_t>(STDOUT_FILENO, STDERR_FILENO));
} }
auto res = parser.eval(cmd, ios); auto res = parser.eval(cmd, ios);
if (res.status.exit_code() == 2) { if (res.status.normal_exited() && res.status.exit_code() == 2) {
streams.err.append_format(BUILTIN_ERR_MISSING_HELP, name_esc.c_str(), name_esc.c_str()); streams.err.append_format(BUILTIN_ERR_MISSING_HELP, name_esc.c_str(), name_esc.c_str());
} }
} }