class Aruba::Processes::BasicProcess
Basic Process
`BasicProcess` is not meant for direct use - `BasicProcess.new` - by users.
@private
Attributes
environment[R]
exit_status[R]
exit_timeout[R]
io_wait_timeout[R]
main_class[R]
startup_wait_time[R]
working_directory[R]
Public Class Methods
new(cmd, exit_timeout, io_wait_timeout, working_directory, environment = ENV.to_hash.dup, main_class = nil, stop_signal = nil, startup_wait_time = 0)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 16 def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, environment = ENV.to_hash.dup, main_class = nil, stop_signal = nil, startup_wait_time = 0) @cmd = cmd @working_directory = working_directory @environment = environment @main_class = main_class @exit_status = nil @stop_signal = stop_signal @startup_wait_time = startup_wait_time @exit_timeout = exit_timeout @io_wait_timeout = io_wait_timeout @started = false end
Public Instance Methods
after_run()
click to toggle source
Hook which is run after command is run
# File lib/aruba/processes/basic_process.rb, line 107 def after_run; end
before_run()
click to toggle source
Hook which is run before command is run
# File lib/aruba/processes/basic_process.rb, line 104 def before_run; end
close_io(*)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 62 def close_io(*) NotImplementedError end
commandline()
click to toggle source
Return command line
# File lib/aruba/processes/basic_process.rb, line 32 def commandline @cmd end
inspect()
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 109 def inspect out = stdout(:wait_for_io => 0) + stderr(:wait_for_io => 0) out = if out.length > 76 out[0, 75] + ' ...' else out end format '#<%s:%s commandline="%s": output="%s">', self.class, self.object_id, commandline, out end
Also aliased as: to_s
output(opts = {})
click to toggle source
Output stderr and stdout
# File lib/aruba/processes/basic_process.rb, line 42 def output(opts = {}) stdout(opts) + stderr(opts) end
pid()
click to toggle source
Output pid of process
# File lib/aruba/processes/basic_process.rb, line 37 def pid 'No implemented' end
restart()
click to toggle source
Restart a command
# File lib/aruba/processes/basic_process.rb, line 75 def restart stop start end
run!()
click to toggle source
@deprecated @private
# File lib/aruba/processes/basic_process.rb, line 97 def run! Aruba.platform.deprecated('The use of "command#run!" is deprecated. You can simply use "command#start" instead.') start end
send_signal(*)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 66 def send_signal(*) NotImplementedError end
started?()
click to toggle source
Was process already started
# File lib/aruba/processes/basic_process.rb, line 86 def started? @started == true end
stderr(*)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 58 def stderr(*) NotImplementedError end
stdin(*)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 50 def stdin(*) NotImplementedError end
stdout(*)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 54 def stdout(*) NotImplementedError end
stopped?()
click to toggle source
Was process already stopped
# File lib/aruba/processes/basic_process.rb, line 81 def stopped? @started == false end
timed_out?()
click to toggle source
Does the process failed to stop in time
# File lib/aruba/processes/basic_process.rb, line 91 def timed_out? @timed_out == true end
wait()
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 70 def wait NotImplementedError end
write(*)
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 46 def write(*) NotImplementedError end
Private Instance Methods
arguments()
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 128 def arguments return Shellwords.split(commandline)[1..-1] if Shellwords.split(commandline).size > 1 [] end
command()
click to toggle source
# File lib/aruba/processes/basic_process.rb, line 124 def command Shellwords.split(commandline).first end