class Omnibus::CommandTimeout

Public Class Methods

new(cmd) click to toggle source
Calls superclass method
# File lib/omnibus/exceptions.rb, line 278
    def initialize(cmd)
      status = cmd.exitstatus

      if cmd.environment.nil? || cmd.environment.empty?
        env = nil
      else
        env = cmd.environment.sort.map { |k, v| "#{k}=#{v}" }.join(" ")
      end

      command = cmd.command
      command_with_env = [env, command].compact.join(" ")

      timeout = cmd.timeout.to_s.reverse.gsub(/...(?=.)/, '\&,').reverse

      super <<~EOH
        The following shell command timed out at #{timeout} seconds:

            $ #{command_with_env}

        Please increase the `:timeout' value or run the command manually to make sure it
        is completing successfully. Sometimes it is common for a command to wait for
        user input.
      EOH
    end