Sha256: 812e728bd64926a4f39c489ea8b6dc53442ab00cdf4588b53c9621a5c31c74d5

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

#!/usr/bin/env ruby
require 'pty'
require 'readline'
bin = "#{Gem.bin_path('voltos', 'voltos')}-cli"
status = PTY.spawn(bin, *ARGV) do |stdout, stdin, pid|
  Thread.new do
    loop { STDOUT.print stdout.getc }
  end
  Thread.new do
    loop do
      input = Readline.readline("", true)
      if input.nil?
        stdout.close
        stdin.close
      end
      stdin.puts input.strip
    end
  end
  begin
    Process::waitpid(pid) rescue nil
  rescue SystemExit, Interrupt
    Process.kill('INT', pid)
    retry
  rescue EOFError
    puts "Ctrl-D"
  end
end
exit(status.to_i)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voltos-0.3.0.rc8 exe/voltos