about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-24 02:47:40 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-24 02:47:40 +0000
commit86eac3ce63b7b3951a02b0cf2a25e11d40930569 (patch)
treeb18bf0834852fd6d61eeaf1afc3e6a1f9fff5cc8
parent1f381662a8bbe12be52f030cc85268c1edc91246 (diff)
downloadwrongdoc-86eac3ce63b7b3951a02b0cf2a25e11d40930569.tar.gz
release: redirect stdout conditionally
No point in redirecting if we're already the same descriptor.
-rw-r--r--lib/wrongdoc/release.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/wrongdoc/release.rb b/lib/wrongdoc/release.rb
index f6c72e5..21d8651 100644
--- a/lib/wrongdoc/release.rb
+++ b/lib/wrongdoc/release.rb
@@ -21,8 +21,10 @@ module Wrongdoc::Release
     cmds.each_with_index do |cmd,i|
       i > 0 and io.puts
       pid, status = Process.waitpid2(fork do
-        $stdout.reopen(io)
-        io.close
+        if io.fileno != $stdout.fileno
+          $stdout.reopen(io)
+          io.close
+        end
         exec *cmd
       end)
       status.success? or abort status.inspect