Sha256: c3cec51b6530e09a5dde19b1030f28c729a4d97c1c3bac5cad503dfb2e2c61aa

Contents?: true

Size: 1.65 KB

Versions: 19

Compression:

Stored size: 1.65 KB

Contents

require 'aruba/processes/spawn_process'

# Aruba
module Aruba
  # Processes
  module Processes
    # Run your command in `systemd()` to make debugging it easier
    #
    # `DebugProcess` is not meant for direct use - `InProcess.new` - by
    # users. Only it's public methods are part of the public API of aruba, e.g.
    # `#stdin`, `#stdout`.
    #
    # @private
    class DebugProcess < BasicProcess
      # Use only if mode is :debug
      def self.match?(mode)
        mode == :debug || (mode.is_a?(Class) && mode <= DebugProcess)
      end

      def start
        Dir.chdir @working_directory do
          Aruba.platform.with_environment(environment) do
            @exit_status = system(command, *arguments) ? 0 : 1
          end
        end
      end

      # Return stdin
      #
      # @return [NilClass]
      #   Nothing
      def stdin(*); end

      # Return stdout
      #
      # @return [String]
      #   A predefined string to make users aware they are using the DebugProcess
      def stdout(*)
        'This is the debug launcher on STDOUT. If this output is unexpected, please check your setup.'
      end

      # Return stderr
      #
      # @return [String]
      #   A predefined string to make users aware they are using the DebugProcess
      def stderr(*)
        'This is the debug launcher on STDERR. If this output is unexpected, please check your setup.'
      end

      # Write to nothing
      def write(*); end

      # Close nothing
      def close_io(*); end

      # Stop process
      def stop(*)
        @started = false

        @exit_status
      end

      # Terminate process
      def terminate(*)
        stop
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
aruba-0.14.14 lib/aruba/processes/debug_process.rb
aruba-0.14.13 lib/aruba/processes/debug_process.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/aruba-0.14.12/lib/aruba/processes/debug_process.rb
aruba-0.14.12 lib/aruba/processes/debug_process.rb
aruba-0.14.11 lib/aruba/processes/debug_process.rb
aruba-0.14.10 lib/aruba/processes/debug_process.rb
aruba-0.14.9 lib/aruba/processes/debug_process.rb
aruba-0.14.8 lib/aruba/processes/debug_process.rb
aruba-0.14.7 lib/aruba/processes/debug_process.rb
aruba-0.14.6 lib/aruba/processes/debug_process.rb
aruba-0.14.5 lib/aruba/processes/debug_process.rb
aruba-0.14.4 lib/aruba/processes/debug_process.rb
aruba-0.14.3 lib/aruba/processes/debug_process.rb
aruba-1.0.0.pre.alpha.2 lib/aruba/processes/debug_process.rb
aruba-1.0.0.pre.alpha.1 lib/aruba/processes/debug_process.rb
aruba-win-fix-0.14.2 lib/aruba/processes/debug_process.rb
aruba-0.14.2 lib/aruba/processes/debug_process.rb
aruba-0.14.1 lib/aruba/processes/debug_process.rb
aruba-0.14.0 lib/aruba/processes/debug_process.rb