Class: Aruba::Processes::DebugProcess

Inherits:
BasicProcess show all
Defined in:
lib/aruba/processes/debug_process.rb

Overview

Run your command in system() to make debugging it easier. This will make the process use the default input and output streams so the developer can interact with it directly. This means that part of Aruba's functionality is disabled. I.e., checks for output, and passing input programmatically will not work.

DebugProcess is not meant for direct use - DebugProcess.new - by users. Only its public methods are part of the public API of aruba, e.g. #stdin, #stdout.

Instance Attribute Summary

Attributes inherited from BasicProcess

#environment, #exit_status, #exit_timeout, #io_wait_timeout, #main_class, #startup_wait_time, #stop_signal, #working_directory

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicProcess

#after_run, #arguments, #before_run, #command, #commandline, #content, #filesystem_status, #initialize, #inspect, #output, #pid, #restart, #send_signal, #started?, #stopped?, #timed_out?, #wait

Constructor Details

This class inherits a constructor from Aruba::Processes::BasicProcess

Class Method Details

.match?(mode) ⇒ Boolean

Use only if mode is :debug

Returns:

  • (Boolean)


20
21
22
# File 'lib/aruba/processes/debug_process.rb', line 20

def self.match?(mode)
  mode == :debug || (mode.is_a?(Class) && mode <= DebugProcess)
end

Instance Method Details

#close_ioObject

Close nothing



59
# File 'lib/aruba/processes/debug_process.rb', line 59

def close_io(*); end

#interactive?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/aruba/processes/debug_process.rb', line 73

def interactive?
  true
end

#startObject



24
25
26
27
28
29
30
31
# File 'lib/aruba/processes/debug_process.rb', line 24

def start
  @started = true
  Dir.chdir @working_directory do
    Aruba.platform.with_environment(environment) do
      @exit_status = system(command, *arguments) ? 0 : 1
    end
  end
end

#stderrString

Return stderr

Returns:

  • (String)

    A predefined string to make users aware they are using the DebugProcess



51
52
53
# File 'lib/aruba/processes/debug_process.rb', line 51

def stderr(*)
  'This is the debug launcher on STDERR. If this output is unexpected, please check your setup.'
end

#stdinNilClass

Return stdin

Returns:

  • (NilClass)

    Nothing



37
# File 'lib/aruba/processes/debug_process.rb', line 37

def stdin(*); end

#stdoutString

Return stdout

Returns:

  • (String)

    A predefined string to make users aware they are using the DebugProcess



43
44
45
# File 'lib/aruba/processes/debug_process.rb', line 43

def stdout(*)
  'This is the debug launcher on STDOUT. If this output is unexpected, please check your setup.'
end

#stopObject

Stop process



62
63
64
65
66
# File 'lib/aruba/processes/debug_process.rb', line 62

def stop(*)
  @started = false

  @exit_status
end

#terminateObject

Terminate process



69
70
71
# File 'lib/aruba/processes/debug_process.rb', line 69

def terminate(*)
  stop
end

#writeObject

Write to nothing



56
# File 'lib/aruba/processes/debug_process.rb', line 56

def write(*); end