lib/rouge/cli.rb in rouge-1.11.0 vs lib/rouge/cli.rb in rouge-1.11.1
- old
+ new
@@ -11,20 +11,20 @@
end
def file
case input
when '-'
- $stdin
+ IO.new($stdin.fileno, 'r:utf-8')
when String
- File.new(input)
+ File.new(input, 'r:utf-8')
when ->(i){ i.respond_to? :read }
input
end
end
def read
@read ||= begin
- File.read(file, encoding: 'utf-8')
+ file.read
rescue => e
$stderr.puts "unable to open #{input}: #{e.message}"
exit 1
ensure
file.close