Fix ExitCode calc on StashOnFailure

Previous sbt.Exec != String match would never fail
This commit is contained in:
Marko Elezovic 2021-01-19 09:03:25 +01:00
parent 600942303f
commit 79645dfee7
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
}