Sha256: 1fd1cc4635900b3dd76c230bb01d85e6b9b8556cc351a3557b413abccdb55036

Contents?: true

Size: 643 Bytes

Versions: 3

Compression:

Stored size: 643 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

3 entries across 3 versions & 1 rubygems

Version Path
voltos-0.3.0.rc2 exe/voltos
voltos-0.3.0.rc1 exe/voltos
voltos-0.3.0rc1 exe/voltos