Browse code

Fix usage without "-v"

Lorenz Hüdepohl authored on 03/11/2017 15:41:56
Showing 1 changed files
... ...
@@ -176,16 +176,17 @@ MockStdout = namedtuple("MockStdout", ["cmd_string"])
176 176
 
177 177
 class echoPopen(Popen):
178 178
     def __init__(self, commands, stdin=None, stdout=None, **kwargs):
179
+        if stdin is not None:
180
+            in_pipe = stdin.cmd_string + " | "
181
+        else:
182
+            in_pipe = ""
183
+        if commands[0] == "ssh":
184
+            cmd = " ".join(commands[0:2]) + ' "' + " ".join(commands[2:]) + '"'
185
+        else:
186
+            cmd = " ".join(commands)
187
+        cmd_string = in_pipe + cmd
188
+
179 189
         if args.verbose or args.dry_run:
180
-            if stdin is not None:
181
-                in_pipe = stdin.cmd_string + " | "
182
-            else:
183
-                in_pipe = ""
184
-            if commands[0] == "ssh":
185
-                cmd = " ".join(commands[0:2]) + ' "' + " ".join(commands[2:]) + '"'
186
-            else:
187
-                cmd = " ".join(commands)
188
-            cmd_string = in_pipe + cmd
189 190
             if stdout is None:
190 191
                 print(cmd_string)
191 192