summaryrefslogtreecommitdiff
path: root/lib/rake/trace_output.rb
blob: e4d61cfb93cfe171b024d92b5c3ca3a9aa53e199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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