fix(process): leave exit action errors unset
Align ActionProcessExited with the documented contract by keeping the reserved Error field nil for both start failures and normal exits. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
3930aed49a
commit
dec0231938
2 changed files with 5 additions and 5 deletions
|
|
@ -232,7 +232,7 @@ func (s *Service) StartWithOptions(ctx context.Context, opts RunOptions) (*Proce
|
|||
ID: id,
|
||||
ExitCode: -1,
|
||||
Duration: proc.Duration,
|
||||
Error: err,
|
||||
Error: nil,
|
||||
})
|
||||
}
|
||||
return proc, coreerr.E("Service.StartWithOptions", "failed to start process", err)
|
||||
|
|
@ -291,7 +291,7 @@ func (s *Service) StartWithOptions(ctx context.Context, opts RunOptions) (*Proce
|
|||
err := cmd.Wait()
|
||||
|
||||
duration := time.Since(proc.StartedAt)
|
||||
status, exitCode, exitErr, signalName := classifyProcessExit(err)
|
||||
status, exitCode, _, signalName := classifyProcessExit(err)
|
||||
|
||||
proc.mu.Lock()
|
||||
proc.Duration = duration
|
||||
|
|
@ -309,7 +309,7 @@ func (s *Service) StartWithOptions(ctx context.Context, opts RunOptions) (*Proce
|
|||
ID: id,
|
||||
ExitCode: exitCode,
|
||||
Duration: duration,
|
||||
Error: exitErr,
|
||||
Error: nil,
|
||||
}
|
||||
|
||||
if c := s.coreApp(); c != nil {
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ func TestService_Actions(t *testing.T) {
|
|||
defer mu.Unlock()
|
||||
assert.Len(t, exited, 1)
|
||||
assert.Equal(t, proc.ID, exited[0].ID)
|
||||
assert.Error(t, exited[0].Error)
|
||||
assert.Nil(t, exited[0].Error)
|
||||
assert.Equal(t, StatusKilled, proc.Status)
|
||||
})
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ func TestService_Actions(t *testing.T) {
|
|||
defer mu.Unlock()
|
||||
require.Len(t, exited, 1)
|
||||
assert.Equal(t, -1, exited[0].ExitCode)
|
||||
assert.Error(t, exited[0].Error)
|
||||
assert.Nil(t, exited[0].Error)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue