From 164d991118a1f391e15b42d70c51c7b2cfd819e7 Mon Sep 17 00:00:00 2001 From: matthias314 Date: Sun, 1 Dec 2024 16:21:49 -0500 Subject: [PATCH] avoid creating `nil` callback for `JobSpawn` --- internal/shell/job.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/shell/job.go b/internal/shell/job.go index 6e1f4b18a..766b95168 100644 --- a/internal/shell/job.go +++ b/internal/shell/job.go @@ -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}