From 3712058fedf40a36a623c6e9283e36eccf80619c Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 14 Oct 2021 15:10:09 +0300 Subject: [PATCH] Do not panic with -k and command was not run --- doc/news.texi | 2 ++ run.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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, -- 2.44.0