Sha256: 8a3e277b92ec994898db262f78883389aff9ffef0fbc3158f87ec7f542829356

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

module Cocaine
  class CommandLine
    class PosixRunner
      if Cocaine::CommandLine.posix_spawn_available?

        def call(command, env = {})
          input, output = IO.pipe
          pid = spawn(env, command, :out => output)
          waitpid(pid)
          output.close
          input.read
        end

        private

        def spawn(*args)
          POSIX::Spawn.spawn(*args)
        end

        def waitpid(pid)
          Process.waitpid(pid)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cocaine-0.3.1 lib/cocaine/command_line/runners/posix_runner.rb
cocaine-0.3.0 lib/cocaine/command_line/runners/posix_runner.rb