X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=run.go;h=4ca90d649af939e151326ea2636f65cd59e6f3bc;hb=d830f32d30e4ea9d9f06ae835db6ec5c4822dcfc;hp=af71b3b8b3b4c4b08d39082e295d2fa48316ed62;hpb=314f58ec690c7321535d6718e8d3a0ecb4cac019;p=goredo.git diff --git a/run.go b/run.go index af71b3b..4ca90d6 100644 --- a/run.go +++ b/run.go @@ -35,7 +35,7 @@ import ( "time" "go.cypherpunks.ru/recfile" - "go.cypherpunks.ru/tai64n" + "go.cypherpunks.ru/tai64n/v2" "golang.org/x/sys/unix" ) @@ -67,6 +67,8 @@ var ( flagTraceAll = flag.Bool("xx", false, fmt.Sprintf("trace (sh -x) all targets (%s=1)", EnvTrace)) flagStderrKeep = flag.Bool("logs", false, fmt.Sprintf("keep job's stderr (%s=1)", EnvStderrKeep)) flagStderrSilent = flag.Bool("silent", false, fmt.Sprintf("do not print job's stderr (%s=1)", EnvStderrSilent)) + + TracedAll bool ) type RunErr struct { @@ -87,7 +89,7 @@ func (e *RunErr) Name() string { if e.Finished == nil { return name } - return fmt.Sprintf("%s (%fsec)", name, e.Finished.Sub(*e.Started).Seconds()) + return fmt.Sprintf("%s (%.3fs)", name, e.Finished.Sub(*e.Started).Seconds()) } func (e RunErr) Error() string { @@ -304,7 +306,7 @@ func runScript(tgtOrig string, errs chan error, traced bool) error { args = make([]string, 0, 3) } else { cmdName = "/bin/sh" - if traced { + if traced || TracedAll { args = append(args, "-ex") } else { args = append(args, "-e") @@ -464,9 +466,9 @@ func runScript(tgtOrig string, errs chan error, traced bool) error { continue } if fdStderr != nil { - tai64n.FromTime(time.Now(), ts) + ts.FromTime(time.Now()) LogMutex.Lock() - fmt.Fprintf(fdStderr, "%s %s\n", ts.Encode(), line) + fmt.Fprintln(fdStderr, tai64n.Encode(ts[:]), line) LogMutex.Unlock() } if StderrSilent {