Don't override exit status when stderr is closed by 2>&-

fixes #6470
This commit is contained in:
Norio Nomura 2020-01-07 21:48:57 +09:00 committed by Fabian Homborg
parent b7a0031174
commit cc7618985a
2 changed files with 6 additions and 1 deletions

View File

@ -292,7 +292,7 @@ static bool run_internal_process(process_t *p, std::string outdata, std::string
// If we have nothing to write we can elide the thread.
// TODO: support eliding output to /dev/null.
if (f->skip_out() && f->skip_err()) {
f->internal_proc->mark_exited(proc_status_t::from_exit_code(EXIT_SUCCESS));
f->internal_proc->mark_exited(p->status);
return true;
}

View File

@ -0,0 +1,5 @@
# RUN: %fish %s
argparse r-require= -- --require 2>/dev/null ; echo $status
# CHECK: 2
argparse r-require= -- --require 2>&- ; echo $status
# CHECK: 2