Merge pull request #6266 from melezov/fix-exitcode-calc

Fix ExitCode calc on StashOnFailure
This commit is contained in:
eugene yokota 2021-01-19 10:10:41 -05:00 committed by GitHub
commit c0e8267756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -251,7 +251,7 @@ object MainLoop {
} finally {
// Flush the terminal output after command evaluation to ensure that all output
// is displayed in the thin client before we report the command status. Also
// set the promt to whatever it was before we started evaluating the task.
// set the prompt to whatever it was before we started evaluating the task.
restoreTerminal()
}
if (exec.execId.fold(true)(!_.startsWith(networkExecPrefix)) &&
@ -334,6 +334,7 @@ object MainLoop {
// so we also use that to indicate that the execution failed
private[this] def exitCodeFromStateOnFailure(state: State, prevState: State): ExitCode =
if (prevState.onFailure.isDefined && state.onFailure.isEmpty &&
state.currentCommand.fold(true)(_ != StashOnFailure)) ExitCode(ErrorCodes.UnknownError)
else ExitCode.Success
state.currentCommand.fold(true)(_.commandLine != StashOnFailure)) {
ExitCode(ErrorCodes.UnknownError)
} else ExitCode.Success
}