Sha256: 20594db96fef35c86b716c12dd61bf13988b57643937b436513f7c857486cc94

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

#!/usr/bin/env ruby
require 'open3'
require 'readline'
bin = "#{Gem.bin_path('voltos', 'voltos')}-cli"
process = nil
Open3.popen3(bin, *ARGV) do |stdin, stdout, stderr, thread|
  Thread.new do
    while !stdin.closed? do
      input = Readline.readline("", true).strip
      stdin.puts input
    end
  end

  errThread = Thread.new do
    while !stderr.eof?  do
      putc stderr.readchar
    end
  end

  outThread = Thread.new do
    while !stdout.eof?  do
      putc stdout.readchar
    end
  end

  Process::waitpid(thread.pid) rescue nil
  errThread.join
  outThread.join
  process = thread.value
end
exit(process.exitstatus) if !process.nil?

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voltos-0.3.0.rc3 exe/voltos