From: Sergey Matveev Date: Thu, 14 Oct 2021 12:10:09 +0000 (+0300) Subject: Do not panic with -k and command was not run X-Git-Tag: v1.16.0~2 X-Git-Url: http://www.git.cypherpunks.ru/?p=goredo.git;a=commitdiff_plain;h=3712058fedf40a36a623c6e9283e36eccf80619c Do not panic with -k and command was not run --- diff --git a/doc/news.texi b/doc/news.texi index 2adfe78..e98554e 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -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 b836ad9..7128bb8 100644 --- 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,