Sha256: 692fed1dee7d524b86f962f23b5db83ce35c59a1f9a74374f5718da41ce1ba8a

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 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) if !process.nil?

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voltos-0.3.0.rc4 exe/voltos