Skip to content

Commit

Permalink
avoid creating nil callback for JobSpawn
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias314 committed Dec 1, 2024
1 parent 56c1f75 commit 164d991
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/shell/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ func JobSpawn(cmdName string, cmdArgs []string, onStdout, onStderr, onExit func(
go func() {
// Run the process in the background and create the onExit callback
proc.Run()
jobFunc := JobFunction{onExit, outbuf.String(), userargs}
Jobs <- jobFunc
if onExit != nil {
jobFunc := JobFunction{onExit, outbuf.String(), userargs}
Jobs <- jobFunc
}
}()

return &Job{proc, stdin}
Expand Down

0 comments on commit 164d991

Please sign in to comment.