drivers: set -1 exit code in case executor gets killed (#25453)

Nomad driver handles incorrectly set exit code 0 in case of executor failure.
This corrects that behavior.

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
This commit is contained in:
Piotr Kazmierczak
2025-03-20 15:06:39 +01:00
committed by GitHub
parent b3f28f9387
commit cb8f4ea452
6 changed files with 83 additions and 0 deletions

View File

@@ -604,6 +604,12 @@ func (d *Driver) handleWait(ctx context.Context, handle *taskHandle, ch chan *dr
result = &drivers.ExitResult{
Err: fmt.Errorf("executor: error waiting on process: %v", err),
}
// if process state is nil, we've probably been killed, so return a reasonable
// exit state to the handlers
if ps == nil {
result.ExitCode = -1
result.OOMKilled = false
}
} else {
result = &drivers.ExitResult{
ExitCode: ps.ExitCode,