]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Differentiate Cmd and Arg keys for clarity
[goredo.git] / run.go
diff --git a/run.go b/run.go
index b836ad9982631d25b70c635f8d47daa01f2d56a8..1e8472f3602b514f9335712028411f48f5c163a0 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,
@@ -475,7 +479,7 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
                                        })
                                        fields = append(fields, recfile.Field{Name: "Cmd", Value: cmdName})
                                        for _, arg := range args {
-                                               fields = append(fields, recfile.Field{Name: "Cmd", Value: arg})
+                                               fields = append(fields, recfile.Field{Name: "Arg", Value: arg})
                                        }
                                        for _, env := range cmd.Env {
                                                fields = append(fields, recfile.Field{Name: "Env", Value: env})