diff options
Diffstat (limited to 'lib/rake/trace_output.rb')
-rw-r--r-- | lib/rake/trace_output.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/rake/trace_output.rb b/lib/rake/trace_output.rb new file mode 100644 index 0000000000..e4d61cfb93 --- /dev/null +++ b/lib/rake/trace_output.rb @@ -0,0 +1,19 @@ +module Rake + module TraceOutput + + # Write trace output to output stream +out+. + # + # The write is done as a single IO call (to print) to lessen the + # chance that the trace output is interrupted by other tasks also + # producing output. + def trace_on(out, *strings) + sep = $\ || "\n" + if strings.empty? + output = sep + else + output = strings.map { |s| s.end_with?(sep) ? s : s + sep }.join + end + out.print(output) + end + end +end |