lib/autobuild/subcommand.rb in autobuild-1.10.0.b2 vs lib/autobuild/subcommand.rb in autobuild-1.10.0.b3
- old
+ new
@@ -195,18 +195,19 @@
# @return [String] the command standard output
def self.run(target, phase, *command)
STDOUT.sync = true
input_streams = []
- options = Hash[retry: false, env: ENV.to_hash, env_inherit: true]
+ options = Hash[retry: false, env: ENV.to_hash, env_inherit: true, encoding: 'BINARY']
if command.last.kind_of?(Hash)
options = command.pop
options = Kernel.validate_options options,
input: nil, working_directory: nil, retry: false,
input_streams: [],
env: ENV.to_hash,
- env_inherit: true
+ env_inherit: true,
+ encoding: 'BINARY'
if options[:input]
input_streams << File.open(options[:input])
end
if options[:input_streams]
@@ -244,13 +245,11 @@
open_flag = if Autobuild.keep_oldlogs then 'a'
elsif Autobuild.registered_logfile?(logname) then 'a'
else 'w'
end
- if defined? Encoding
- open_flag << ":BINARY"
- end
+ open_flag << ":BINARY"
Autobuild.register_logfile(logname)
subcommand_output = Array.new
env = options[:env].dup
@@ -383,10 +382,10 @@
# If the caller asked for process output, provide it to him
# line-by-line.
outwrite.close
outread.each_line do |line|
- line.force_encoding('BINARY')
+ line.force_encoding(options[:encoding])
line = line.chomp
subcommand_output << line
if Autobuild.verbose
STDOUT.puts line