Sha256: 30421a2e4b0e4115d40cd9812629a9c5c5c47acde32732e9e2cb8798ff96b3f7
Contents?: true
Size: 966 Bytes
Versions: 4
Compression:
Stored size: 966 Bytes
Contents
require 'shellwords' require 'stringio' module Aruba class InProcess include Shellwords class FakeKernel attr_reader :exitstatus def initialize @exitstatus = 0 end def exit(exitstatus) @exitstatus = exitstatus end end def self.main_class=(main_class) @@main_class = main_class end def initialize(cmd, exit_timeout, io_wait) args = shellwords(cmd) @argv = args[1..-1] @stdin = StringIO.new @stdout = StringIO.new @stderr = StringIO.new @kernel = FakeKernel.new end def run! raise "You need to call Aruba::InProcess.main_class = YourMainClass" unless @@main_class @@main_class.new(@argv, @stdin, @stdout, @stderr, @kernel).execute! yield self if block_given? end def stop(reader) @kernel.exitstatus end def stdout @stdout.string end def stderr @stderr.string end end end
Version data entries
4 entries across 4 versions & 2 rubygems