voltos 0.3.0.rc10 → 0.3.0.rc11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/voltos +45 -23
  3. data/lib/voltos/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: badb07b7a5602fde134ef7d34a57c97b1da3f59f
4
- data.tar.gz: 76f47e84b81337f3057aee325c76867f695c89bf
3
+ metadata.gz: 95927f2e70936a2a34eba426842f51affd050a7e
4
+ data.tar.gz: b13eb1e0e9e464dcb1938e2f2a9de3eac6a10438
5
5
  SHA512:
6
- metadata.gz: 35cf12382c288f86ce1925e8e3970c2e037ed086bb8293e0004aab379cede0aee3094f75ea7a5b81d4c5c559a346d9971eaf4ebf94f95c4fd751504bbace18bd
7
- data.tar.gz: 0694506e6e01712aea92ebc77e1d73e119c61f3b16d1e1e2a642cd1557d029dee751ca53ce392703d55ba3a9019b3d2bdb4f08a6cc8183e7253aed9d53cad169
6
+ metadata.gz: 154886e9b986bde9d457da7eb0f2929779796a98b9a11c1520c84c68806fedde3d84d5d3e7deb77880fca3dad8757398960bbe7813473b2445f96cc687152bcf
7
+ data.tar.gz: acebddbec308e50d4f11b0b44a25d20a87133a1dacb396bee50a5ef905a5284c8a64950e9e65e5436db231bcb1c4992edd5928f488e74cce00ffa6e59d5bc37d
data/exe/voltos CHANGED
@@ -1,36 +1,58 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'pty'
3
+ require 'open3'
3
4
  require 'readline'
4
5
  STDOUT.sync = true
5
6
  bin = "#{Gem.bin_path('voltos', 'voltos')}-cli"
6
- status = PTY.spawn(bin, *ARGV) do |stdout, stdin, pid|
7
- stdout.sync = true
8
- Thread.new do
9
- loop do
10
- STDOUT.print stdout.getc
7
+ if STDIN.tty?
8
+ status = PTY.spawn(bin, *ARGV) do |stdout, stdin, pid|
9
+ stdout.sync = true
10
+ Thread.new do
11
+ loop do
12
+ STDOUT.print stdout.getc
13
+ end
11
14
  end
12
- end
13
- Thread.new do
14
- loop do
15
- input = Readline.readline("", true)
16
- if input.nil?
17
- stdout.flush
18
- stdout.close
19
- stdin.close
15
+ Thread.new do
16
+ loop do
17
+ input = Readline.readline("", true)
18
+ if input.nil?
19
+ stdout.flush
20
+ stdout.close
21
+ stdin.close
22
+ end
23
+ stdin.puts input.strip
24
+ end
25
+ end
26
+ begin
27
+ Process::waitpid(pid) rescue nil
28
+ while out = stdout.getc do
29
+ STDOUT.print out
20
30
  end
21
- stdin.puts input.strip
31
+ rescue SystemExit, Interrupt
32
+ Process.kill('INT', pid)
33
+ retry
34
+ rescue EOFError
35
+ puts "Ctrl-D"
36
+ rescue IOError
22
37
  end
23
38
  end
24
- begin
25
- Process::waitpid(pid) rescue nil
26
- while out = stdout.getc do
27
- STDOUT.print out
39
+ else
40
+ Open3.popen3(bin, *ARGV) do |stdin, stdout, stderr, thread|
41
+ errThread = Thread.new do
42
+ while !stderr.eof? do
43
+ putc stderr.readchar
44
+ end
45
+ end
46
+ outThread = Thread.new do
47
+ while !stdout.eof? do
48
+ putc stdout.readchar
49
+ end
28
50
  end
29
- rescue SystemExit, Interrupt
30
- Process.kill('INT', pid)
31
- retry
32
- rescue EOFError
33
- puts "Ctrl-D"
51
+ Process::waitpid(thread.pid) rescue nil
52
+ errThread.join
53
+ outThread.join
54
+ process = thread.value
55
+ status = process.exitstatus.to_i if !process.nil?
34
56
  end
35
57
  end
36
58
  exit(status.to_i)
@@ -1,3 +1,3 @@
1
1
  module Voltos
2
- VERSION = "0.3.0.rc10"
2
+ VERSION = "0.3.0.rc11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voltos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.rc10
4
+ version: 0.3.0.rc11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel May
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler