From 75a7583d4ad2f0cdc869a1028f61594026cae829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 24 Mar 2022 23:05:03 +0100 Subject: [PATCH] :fire: aruba process optimization This was fun and everything, but the patch makes it tricky to upgrade Aruba, so it should go for now. --- features/support/aruba_command.rb | 81 ------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 features/support/aruba_command.rb diff --git a/features/support/aruba_command.rb b/features/support/aruba_command.rb deleted file mode 100644 index 0c261b3d..00000000 --- a/features/support/aruba_command.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'open3' -require 'shellwords' - -module Aruba - remove_const :Command - class Command - attr_reader :commandline, :stdout, :stderr - attr_reader :exit_timeout, :io_wait_timeout, :startup_wait_time, :environment, :stop_signal, :exit_status - - def initialize(cmd, mode:, exit_timeout:, io_wait_timeout:, - working_directory:, environment:, main_class:, stop_signal:, - startup_wait_time:, event_bus:) - @commandline = cmd - @working_directory = working_directory - @event_bus = event_bus - @exit_timeout = exit_timeout - @io_wait_timeout = io_wait_timeout - @startup_wait_time = startup_wait_time - @environment = environment - @stop_signal = stop_signal - - @stopped = false - @exit_status = nil - @stdout = nil - @stderr = nil - end - - def inspect - %(#) - end - - def output - stdout + stderr - end - - def start - @event_bus.notify Events::CommandStarted.new(self) - cmd = Shellwords.split @commandline - @stdin_io, @stdout_io, @stderr_io, @thread = Open3.popen3(@environment, *cmd, chdir: @working_directory) - end - - def write(input) - @stdin_io.write input - @stdin_io.flush - end - - def close_io(io) - case io - when :stdin then @stdin_io.close - else - raise ArgumentError, io.to_s - end - end - - def stop - return if @exit_status - @event_bus.notify Events::CommandStopped.new(self) - terminate - end - - def terminate - return if @exit_status - - close_io(:stdin) - @stdout = @stdout_io.read - @stderr = @stderr_io.read - - status = @thread.value - @exit_status = status.exitstatus - @thread = nil - end - - def interactive? - true - end - - def timed_out? - false - end - end -end