]> Cypherpunks.ru repositories - goredo.git/commitdiff
Fix REDO_TRACE workability
authorSergey Matveev <stargrave@stargrave.org>
Thu, 29 Apr 2021 09:47:36 +0000 (12:47 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 29 Apr 2021 09:47:36 +0000 (12:47 +0300)
doc/news.texi
main.go
run.go
usage.go

index cbcd68dddab30f0254518911d5e44de1fd46bbcc..6d5baba5b14f095271cb8e652504a2ec8d6eb1b2 100644 (file)
@@ -1,6 +1,16 @@
 @node News
 @unnumbered News
 
+@anchor{Release 1.4.0}
+@section Release 1.4.0
+@itemize
+@item
+    Fixed proper @option{-xx} and @env{REDO_TRACE} workability, that
+    previously was not applied to all targets.
+@item
+    Updated dependant libraries.
+@end itemize
+
 @anchor{Release 1.3.0}
 @section Release 1.3.0
 @itemize
diff --git a/main.go b/main.go
index a3773f43b3ce5b7dc96b09a1e52b5570ab084ba8..f6668c2425aeb614dc7103a1f71a709f81700689 100644 (file)
--- a/main.go
+++ b/main.go
@@ -160,10 +160,11 @@ func main() {
        if *flagTraceAll {
                mustSetenv(EnvTrace, "1")
        }
-       if *flagTrace {
+       if os.Getenv(EnvTrace) == "1" {
+               TracedAll = true
                traced = true
        } else {
-               traced = os.Getenv(EnvTrace) == "1"
+               traced = *flagTrace
        }
 
        // Those are internal envs
diff --git a/run.go b/run.go
index 2efd2d31a80e20917f0ee89a027da0f10354ddca..a4aeb8738206b7bac7030d28dce67e07ffb74714 100644 (file)
--- a/run.go
+++ b/run.go
@@ -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 {
@@ -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")
index 80bea559a98c7f6bb9e1bcc89759e5fe35aeb04e..179eb15f49a805382d45853068889938e7bc551c 100644 (file)
--- a/usage.go
+++ b/usage.go
@@ -24,7 +24,7 @@ import (
 )
 
 const (
-       Version  = "1.3.0"
+       Version  = "1.4.0"
        Warranty = `Copyright (C) 2020-2021 Sergey Matveev
 
 This program is free software: you can redistribute it and/or modify