Sha256: b93a8e5d1265f039bfd0e8c7cfda698d6f529f49c7db7263b7f9cf39d3f026a4

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

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

  begin
    Process::waitpid(thread.pid) rescue nil
    errThread.join
    outThread.join
    process = thread.value
  rescue SystemExit, Interrupt
    retry
  end
end
exit(process.exitstatus.to_i) if !process.nil?

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voltos-0.3.0.rc5 exe/voltos