]> Cypherpunks.ru repositories - goredo.git/commitdiff
Do not panic with -k and command was not run
authorSergey Matveev <stargrave@stargrave.org>
Thu, 14 Oct 2021 12:10:09 +0000 (15:10 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 14 Oct 2021 12:10:09 +0000 (15:10 +0300)
doc/news.texi
run.go

index 2adfe78785f86613460c3454a4d3e027e01dbc0c..e98554e57063b033c9a12d4da166873a5d416a73 100644 (file)
@@ -6,6 +6,8 @@
 @itemize
 @item
     Unexistent targets are considered always out-of-date, as it should be.
+@item
+    Do not panic if @env{$REDO_LOGS=1} and we were unable to start the command.
 @end itemize
 
 @anchor{Release 1_15_0}
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,