Class: Dependabot::CommandHelpers::ProcessStatus

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/command_helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(process_status, custom_exitstatus = nil) ⇒ ProcessStatus

Returns a new instance of ProcessStatus.



37
38
39
40
# File 'lib/dependabot/command_helpers.rb', line 37

def initialize(process_status, custom_exitstatus = nil)
  @process_status = process_status
  @custom_exitstatus = custom_exitstatus
end

Instance Method Details

#exitstatusObject



44
45
46
# File 'lib/dependabot/command_helpers.rb', line 44

def exitstatus
  @custom_exitstatus || @process_status.exitstatus || 0
end

#pidObject



56
57
58
# File 'lib/dependabot/command_helpers.rb', line 56

def pid
  @process_status.pid
end

#success?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/dependabot/command_helpers.rb', line 50

def success?
  @custom_exitstatus.nil? ? @process_status.success? || false : @custom_exitstatus.zero?
end

#termsigObject



61
62
63
# File 'lib/dependabot/command_helpers.rb', line 61

def termsig
  @process_status.termsig
end

#to_sObject



67
68
69
70
71
72
73
# File 'lib/dependabot/command_helpers.rb', line 67

def to_s
  if @custom_exitstatus
    "pid #{pid || 'unknown'}: exit #{@custom_exitstatus} (custom status)"
  else
    @process_status.to_s
  end
end