Sha256: 333c047de4f82a457594999a90aa642d53648e07e9c66b84eab942b7322df1ad

Contents?: true

Size: 505 Bytes

Versions: 167

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

require 'open3'

module EacRubyUtils
  module Envs
    class Process
      EXIT_CODE_KEY = :exit_code
      ERR_KEY = :stderr
      OUT_KEY = :stdout

      def initialize(command)
        self.data = { command: command }
        data[OUT_KEY], data[ERR_KEY], data[EXIT_CODE_KEY] = Open3.capture3(command)
        data[EXIT_CODE_KEY] = data[EXIT_CODE_KEY].to_i
      end

      def to_h
        data.dup
      end

      private

      attr_accessor :data
    end
  end
end

Version data entries

167 entries across 167 versions & 3 rubygems

Version Path
eac_ruby_utils-0.94.1 lib/eac_ruby_utils/envs/process.rb
eac_ruby_utils-0.94.0 lib/eac_ruby_utils/envs/process.rb
eac_ruby_utils-0.93.0 lib/eac_ruby_utils/envs/process.rb
avm-tools-0.116.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb
avm-tools-0.116.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb
eac_ruby_utils-0.92.1 lib/eac_ruby_utils/envs/process.rb
avm-tools-0.115.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb