avoid creating nil callback for JobSpawn (#3554)

This commit is contained in:
matthias314
2024-12-02 15:21:29 -05:00
committed by GitHub
parent 56c1f75bad
commit 831e31d483

View File

@@ -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()
if onExit != nil {
jobFunc := JobFunction{onExit, outbuf.String(), userargs}
Jobs <- jobFunc
}
}()
return &Job{proc, stdin}