Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Store all output in a log file

  • Loading branch information...
commit 78e29d0330da263acc9c5d7846e7730d3f18533c 1 parent e307dd8
Jason Smith jhs authored
Showing with 35 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +34 −0 tasks/lib.rb
1  .gitignore
View
@@ -1,3 +1,4 @@
.*.swp
build
git-build/*
+rake.log
34 tasks/lib.rb
View
@@ -3,6 +3,40 @@
require 'find'
require 'tmpdir'
+$stdout_old = $stdout
+$stderr_old = $stderr
+
+log_filename = "rake.log"
+File.unlink(log_filename) if File.exists?(log_filename)
+
+["$stdout", "$stderr"].each do |std|
+ rd, wr = IO.pipe
+ if fork
+ rd.close
+ wr.sync = true
+ eval "#{std}.reopen(wr)"
+ eval "#{std}.sync = true"
+ #Process.wait
+ else
+ # Child
+ wr.close
+ begin
+ # Input must be forked.
+ label = std[1..-1].upcase
+ File.open(log_filename, 'a') do |f|
+ f.sync = true
+ while(line = rd.gets)
+ eval "#{std}_old.puts(line)"
+ f.puts([label, line].join(' '))
+ end
+ end
+ ensure
+ rd.close
+ exit
+ end
+ end
+end
+
require File.dirname(__FILE__) + '/places'
def package_dep opts
Please sign in to comment.
Something went wrong with that request. Please try again.