Sha256: 2744ac09ca36594455926d48921077b1e8809a46cc21809a8007143d9f761b32
Contents?: true
Size: 611 Bytes
Versions: 1
Compression:
Stored size: 611 Bytes
Contents
#!/usr/bin/env ruby require 'pty' require 'readline' STDOUT.sync = true 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 STDOUT.flush exit(status.to_i)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
voltos-0.3.0.rc9 | exe/voltos |