lib/asciidoctor/cli/invoker.rb in asciidoctor-2.0.4 vs lib/asciidoctor/cli/invoker.rb in asciidoctor-2.0.5

- old
+ new

@@ -84,21 +84,23 @@ outfile ||= '-' end end if outfile == '-' - tofile = @out || $stdout + # NOTE set_encoding returns nil on JRuby 9.1 + (tofile = @out) || ((tofile = $stdout).set_encoding UTF_8) elsif outfile opts[:mkdirs] = true tofile = outfile else opts[:mkdirs] = true # automatically calculate outfile based on infile end if stdin # allows use of block to supply stdin, particularly useful for tests - input = block_given? ? yield : STDIN + # NOTE set_encoding returns nil on JRuby 9.1 + block_given? ? (input = yield) : ((input = $stdin).set_encoding UTF_8, UTF_8) input_opts = opts.merge to_file: tofile if show_timings @documents << (::Asciidoctor.convert input, (input_opts.merge timings: (timings = Timings.new))) timings.print_report err, '-' else