voltos 0.3.0.rc11 → 0.3.0.rc12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/voltos +35 -15
- data/lib/voltos/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6108fdaecd4dee14499bcae26dd4f5a92c819cfe
|
4
|
+
data.tar.gz: 91d77ea706f913b4158982679621c685da45250d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7e57721b997651e8af022d97640a5a2fbd1fb33c0946aae5922f1362f8a8eef57b535cd0f80c91d4566326c032c164063f7e3c361a19a7e75072f522ee5c65
|
7
|
+
data.tar.gz: 9baf412dbb50c35f7f781a66b2a82b1cb294ef0484199ae57e5a6dceeb993e81ab1a973c9bc067c3d09285f1fd1c155021904771b9c5c32d1fd1887df5c98034
|
data/exe/voltos
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
require 'pty'
|
3
3
|
require 'open3'
|
4
4
|
require 'readline'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
status = PTY.spawn(bin, *
|
5
|
+
|
6
|
+
def run_as_tty(bin, args)
|
7
|
+
STDOUT.sync = true
|
8
|
+
status = PTY.spawn(bin, *args) do |stdout, stdin, pid|
|
9
9
|
stdout.sync = true
|
10
10
|
Thread.new do
|
11
11
|
loop do
|
@@ -25,34 +25,54 @@ if STDIN.tty?
|
|
25
25
|
end
|
26
26
|
begin
|
27
27
|
Process::waitpid(pid) rescue nil
|
28
|
-
while out = stdout.getc do
|
29
|
-
STDOUT.print out
|
30
|
-
end
|
31
28
|
rescue SystemExit, Interrupt
|
32
29
|
Process.kill('INT', pid)
|
33
30
|
retry
|
34
31
|
rescue EOFError
|
35
|
-
|
36
|
-
rescue IOError
|
32
|
+
rescue IOError, Errno::EIO
|
37
33
|
end
|
38
34
|
end
|
39
|
-
|
35
|
+
status
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_as_daemon(bin, args)
|
39
|
+
process = nil
|
40
40
|
Open3.popen3(bin, *ARGV) do |stdin, stdout, stderr, thread|
|
41
|
+
Thread.new do
|
42
|
+
while !stdin.closed? do
|
43
|
+
input = Readline.readline("", true).strip
|
44
|
+
stdin.puts input
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
41
48
|
errThread = Thread.new do
|
42
49
|
while !stderr.eof? do
|
43
50
|
putc stderr.readchar
|
44
51
|
end
|
45
52
|
end
|
53
|
+
|
46
54
|
outThread = Thread.new do
|
47
55
|
while !stdout.eof? do
|
48
56
|
putc stdout.readchar
|
49
57
|
end
|
50
58
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
59
|
+
|
60
|
+
begin
|
61
|
+
Process::waitpid(thread.pid) rescue nil
|
62
|
+
errThread.join
|
63
|
+
outThread.join
|
64
|
+
process = thread.value
|
65
|
+
rescue SystemExit, Interrupt
|
66
|
+
retry
|
67
|
+
end
|
56
68
|
end
|
69
|
+
return process.exitstatus if process
|
70
|
+
end
|
71
|
+
|
72
|
+
bin = "#{Gem.bin_path('voltos', 'voltos')}-cli"
|
73
|
+
if STDIN.tty?
|
74
|
+
status = run_as_tty(bin, ARGV)
|
75
|
+
else
|
76
|
+
status = run_as_daemon(bin, ARGV)
|
57
77
|
end
|
58
78
|
exit(status.to_i)
|
data/lib/voltos/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.0.rc12
|
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-
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|