Sha256: 328020355e8f27bfbdfae1a6854b45855669fd3a29b63a1c4d02a419f4ad1a6d

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

require 'aruba/processes/spawn_process'

module Aruba
  module Processes
    # Create process
    #
    # @params [String] cmd
    #   Command string
    #
    # @params [Integer] exit_timeout
    #   The timeout until we expect the command to be finished
    #
    # @params [Integer] io_wait
    #   The timeout until we expect the io to be finished
    #
    # @params [String] working_directory
    #   The directory where the command will be executed
    class DebugProcess < BasicProcess
      attr_reader :exit_status

      # @see SpawnProcess
      def initialize(cmd, _exit_timeout, _io_wait, working_directory)
        @cmd               = cmd
        @working_directory = working_directory

        super
      end

      # Return command line
      def commandline
        @cmd
      end

      def run!
        @exit_status = system(@cmd, chdir: @working_directory) ? 0 : 1
      end

      def stdin(*); end

      def stdout(*)
        ''
      end

      def stderr(*)
        ''
      end

      def stop(_reader)
        @stopped = true

        @exit_status
      end

      def terminate(*)
        stop
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aruba-0.7.4 lib/aruba/processes/debug_process.rb
aruba-0.7.3 lib/aruba/processes/debug_process.rb
aruba-0.7.2 lib/aruba/processes/debug_process.rb
aruba-0.7.1 lib/aruba/processes/debug_process.rb
aruba-0.7.0 lib/aruba/processes/debug_process.rb