Skip to content

Commit 96b61d0

Browse files
[swift] Get correct ExitStatus if swift tasks receives signal (#581)
When swift tasks failed with signal, make sure the build system tag that as a signal/exception instead of a regular exit with non-zero error code.
1 parent f741881 commit 96b61d0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SWBTaskExecution/TaskActions/SwiftDriverJobTaskAction.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,18 @@ public final class SwiftDriverJobTaskAction: TaskAction, BuildValueValidatingTas
469469
}
470470

471471
func processFinished(result: CommandExtendedResult) {
472+
guard let status = Processes.ExitStatus.init(rawValue: result.exitStatus) else {
473+
// nil means the job is stopped or continued. It should not call finished.
474+
return
475+
}
472476
// This may be updated by commandStarted in the case of certain failures,
473477
// so only update the exit status in output delegate if it is nil.
474478
if outputDelegate.result == nil {
475479
outputDelegate.updateResult(TaskResult(result))
476480
}
477481
self._commandResult = result.result
478482
do {
479-
try plannedBuild?.jobFinished(job: driverJob, arguments: arguments, pid: pid.pid, environment: environment, exitStatus: .exit(result.exitStatus), output: output)
483+
try plannedBuild?.jobFinished(job: driverJob, arguments: arguments, pid: pid.pid, environment: environment, exitStatus: status, output: output)
480484
} catch {
481485
executionError = error.localizedDescription
482486
}

0 commit comments

Comments
 (0)