CORE-13974
This should fix situations where (for example):
command_1 | command_2 && echo Succeeded
should *NOT* run "echo Succeeded" if any of the command_1 or command_2 has
failed.
This also makes the ExecutePipeline() function on par with the other
"ExecuteXXX()" helpers.
Problem diagnosed by Doug Lyons; patch inspired by contributor 'cagey45'.
return prci.hProcess;
}
-static VOID
+static INT
ExecutePipeline(PARSED_COMMAND *Cmd)
{
#ifdef FEATURE_REDIRECTION
while (--nProcesses >= 0)
CloseHandle(hProcess[nProcesses]);
- return;
+ return nErrorLevel;
failed:
if (hInput)
SetStdHandle(STD_INPUT_HANDLE, hOldConIn);
SetStdHandle(STD_OUTPUT_HANDLE, hOldConOut);
#endif
+
+ return nErrorLevel;
}
INT
Ret = ExecuteCommand(Sub->Next);
break;
case C_PIPE:
- ExecutePipeline(Cmd);
+ Ret = ExecutePipeline(Cmd);
break;
case C_IF:
Ret = ExecuteIf(Cmd);