chiark / gitweb /
hush: Don't lose backslashes in output lines. 1.2.8.3
authorMark Wooding <mdw@distorted.org.uk>
Fri, 14 Jun 2013 11:32:24 +0000 (12:32 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 14 Jun 2013 18:26:01 +0000 (19:26 +0100)
debian/changelog
hush.in

index ca7d1a7c729eca1c01d53960a79278c49f1485ef..30fff971b3610aefee5e9a575fd9bec3d8e64ba4 100644 (file)
@@ -1,3 +1,9 @@
+nsict-utils (1.2.8.3) experimental; urgency=low
+
+  * hush: Don't lose backslashes in output lines.
+
+ -- Mark Wooding <mdw@distorted.org.uk>  Fri, 14 Jun 2013 12:32:10 +0100
+
 nsict-utils (1.2.8.2) experimental; urgency=low
 
   * hush: Close file descriptors around the command, so that we don't wait
diff --git a/hush.in b/hush.in
index 435952706e174f93b900a21e2206ef4a7a1f6150..d5aebcb2d40bd7a5d77ae3420c127deb49e0a5b3 100755 (executable)
--- a/hush.in
+++ b/hush.in
@@ -145,10 +145,11 @@ EOF
 ## stage of a pipeline, where we actually wanted the status of the first.  So
 ## we write that to another pipe (fd 5) and pick it out using command
 ## substitution.
+copy () { while IFS= read -r line; do printf "%s %s\n" "$1" "$line"; done; }
 rc=$(
   { { { { set +e; $lbuf "$cmd" "$@" 3>&- 4>&- 5>&-; echo $? >&5; } |
-       while IFS= read line; do echo "| $line"; done >&4; } 2>&1 |
-      while IFS= read line; do echo "* $line"; done >&4; } 4>&1 |
+       copy "|" >&4; } 2>&1 |
+      copy "*" >&4; } 4>&1 |
     cat -u >&3; } 5>&1 </dev/null
 )