]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Do not panic with -k and command was not run
[goredo.git] / run.go
diff --git a/run.go b/run.go
index b836ad9982631d25b70c635f8d47daa01f2d56a8..7128bb8b3f581f036f06170f98eac9afa0c5f6f8 100644 (file)
--- a/run.go
+++ b/run.go
@@ -457,10 +457,14 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
                                ); err == nil {
                                        fields := []recfile.Field{
                                                {Name: "Build", Value: BuildUUID},
-                                               {Name: "PID", Value: strconv.Itoa(cmd.Process.Pid)},
                                                {Name: "PPID", Value: strconv.Itoa(os.Getpid())},
                                                {Name: "Cwd", Value: cwd},
                                        }
+                                       if cmd.Process != nil {
+                                               fields = append(fields, recfile.Field{
+                                                       Name: "PID", Value: strconv.Itoa(cmd.Process.Pid),
+                                               })
+                                       }
                                        ts := new(tai64n.TAI64N)
                                        ts.FromTime(started)
                                        fields = append(fields,