class Autobuild::SubcommandFailed

An error occured while running a subcommand

Attributes

command[R]
logfile[R]
output[R]
retry[W]
status[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Autobuild::PhaseException::new
# File lib/autobuild/exceptions.rb, line 91
def initialize(*args)
    case args.size
    when 1
        sc = args[0]
        target = sc.target
        command = sc.command
        logfile = sc.logfile
        status = sc.status
        output = sc.output
        @orig_message = sc.exception_message
    when 4, 5
        target, command, logfile, status, output = *args
    else
        raise ArgumentError, "wrong number of arguments, should be 1 or 4..5"
    end

    super(target)
    @command = command
    @logfile = logfile
    @status  = status
    @output = output || Array.new
end

Public Instance Methods

mail?() click to toggle source
# File lib/autobuild/exceptions.rb, line 84
def mail?
    true
end
to_s() click to toggle source
Calls superclass method Autobuild::PhaseException#to_s
# File lib/autobuild/exceptions.rb, line 114
def to_s
    msg = super
    msg << "\n     #{@orig_message}" if @orig_message
    msg << "\n    see #{logfile} for details"

    # If we do not have a status, it means an error occured in the
    # launching process. More importantly, it means we already have a
    # proper explanation for it. Don't display the logfile at all.
    if status
        lines = @output
        logsize = Autobuild.displayed_error_line_count
        if logsize != Float::INFINITY && lines.size > logsize
            lines = lines[-logsize, logsize]
        end
        msg << "\n    last #{lines.size} lines are:\n\n"
        lines.each do |l|
            msg << "    #{l}\n"
        end
    end
    msg
end