class Aruba::Processes::InProcess
@private
`#stdin`, ‘#stdout`.
users. Only it’s public methods are part of the public API of aruba, e.g.
‘InProcess` is not meant for direct use - `InProcess.new` - by
Run command in your ruby process
def self.match?(mode)
def self.match?(mode) mode == :in_process || (mode.is_a?(Class) && mode <= InProcess) end
def close_io(name)
def close_io(name) unless [:stdin, :stdout, :stderr].include? name raise ArgumentError, "Only stdin stdout and stderr are allowed to close" end get_instance_variable(name.to_sym).close end
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, # rubocop:disable Metrics/ParameterLists
def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, # rubocop:disable Metrics/ParameterLists environment = Aruba.platform.environment_variables.hash_from_env, main_class = nil, stop_signal = nil, startup_wait_time = 0) @cmd = cmd @argv = arguments @stdin = StringIO.new @stdout = StringIO.new @stderr = StringIO.new @kernel = FakeKernel.new super end
def interactive?
def interactive? false end
def pid
Output pid of process
def pid $PROCESS_ID end
def start
def start raise "You need to call aruba.config.main_class = YourMainClass" unless main_class @started = true Dir.chdir @working_directory do before_run Aruba.platform.with_environment environment.merge("PWD" => @working_directory) do main_class.new(@argv, @stdin, @stdout, @stderr, @kernel).execute! end after_run yield self if block_given? end end
def stderr(*)
def stderr(*) @stderr.string end
def stdin
def stdin @stdin.string end
def stdout(*)
def stdout(*) @stdout.string end
def stop(*)
def stop(*) @started = false @exit_status = @kernel.exitstatus end
def terminate
def terminate stop end
def write(input)
-
input(String) --
def write(input) @stdin.write input end