Sha256: cdf69e91bfdcc1c2f0e9dc58636e0a7dd1f79379db34709e9e7e900d8891df9d

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

module OptparsePlus
  module ExecutionStrategy
    # <b>OptparsePlus Internal - treat as private</b>
    #
    # ExecutionStrategy for non-modern Rubies that must rely on
    # Open4 to get access to the standard output AND error.
    class Open_4 < MRI
      def run_command(command)
        pid, stdin_io, stdout_io, stderr_io =
          case command
          when String then Open4::popen4(command)
          else Open4::popen4(*command)
          end
        stdin_io.close
        stdout = stdout_io.read
        stderr = stderr_io.read
        _ , status = Process::waitpid2(pid)
        [stdout.chomp,stderr.chomp,status]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
optparse-plus-3.0.1 lib/optparse_plus/execution_strategy/open_4.rb
optparse-plus-3.0.0 lib/optparse_plus/execution_strategy/open_4.rb