lib/autobuild/subcommand.rb in autobuild-1.14.1 vs lib/autobuild/subcommand.rb in autobuild-1.15.0
- old
+ new
@@ -43,13 +43,13 @@
class << self
# Sets the level of parallelism during the build
#
# See #parallel_build_level for detailed information
attr_writer :parallel_build_level
-
+
# set/get a value how much log lines should be displayed on errors
- # this may be an integer or 'ALL' (which will be translated to -1)
+ # this may be an integer or 'ALL' (which will be translated to -1)
# this is not using an attr_accessor to be able to validate the values
def displayed_error_line_count=(value)
@displayed_error_line_count = validate_displayed_error_line_count(value)
end
def displayed_error_line_count
@@ -79,11 +79,11 @@
# Returns the number of CPUs present on this system
def self.autodetect_processor_count
if @processor_count
return @processor_count
end
-
+
if File.file?('/proc/cpuinfo')
cpuinfo = File.readlines('/proc/cpuinfo')
physical_ids, core_count, processor_ids = [], [], []
cpuinfo.each do |line|
case line
@@ -93,11 +93,11 @@
physical_ids << Integer($1)
when /^cpu cores\s+:\s+(\d+)$/
core_count << Integer($1)
end
end
-
+
# Try to count the number of physical cores, not the number of
# logical ones. If the info is not available, fallback to the
# logical count
if (physical_ids.size == core_count.size) && (physical_ids.size == processor_ids.size)
info = Array.new
@@ -130,20 +130,19 @@
@processor_count = 1
end
@processor_count
end
-
- def self.validate_displayed_error_line_count(lines)
+
+ def self.validate_displayed_error_line_count(lines)
if lines == 'ALL'
return Float::INFINITY
elsif lines.to_i > 0
return lines.to_i
end
- raise ConfigError, 'Autobuild.displayed_error_line_count can only be a positive integer or \'ALL\''
+ raise ConfigException.new, 'Autobuild.displayed_error_line_count can only be a positive integer or \'ALL\''
end
-
end
module Autobuild::Subprocess
class Failed < Exception
@@ -292,11 +291,11 @@
logfile.puts " #{command.join(" ")}"
logfile.flush
logfile.sync = true
if !input_streams.empty?
- pread, pwrite = IO.pipe # to feed subprocess stdin
+ pread, pwrite = IO.pipe # to feed subprocess stdin
end
outread, outwrite = IO.pipe
outread.sync = true
outwrite.sync = true
@@ -333,11 +332,11 @@
if !input_streams.empty?
pwrite.close
$stdin.reopen(pread)
end
-
+
exec(env, *command, close_others: false)
rescue Errno::ENOENT
cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I'))
exit(100)
rescue Interrupt
@@ -396,11 +395,11 @@
logfile.puts line
if Autobuild.verbose || transparent_mode?
STDOUT.puts "#{transparent_prefix}#{line}"
elsif block_given?
- # Do not yield
+ # Do not yield
# would mix the progress output with the actual command
# output. Assume that if the user wants the command output,
# the autobuild progress output is unnecessary
yield(line)
end
@@ -445,6 +444,5 @@
error.phase = phase
raise error, e.message
end
end
-