turbot-runner 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/turbot_runner/script_runner.rb +14 -15
- data/lib/turbot_runner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTU4OTExM2RjYzNhYjIwM2NiN2ZmYjU3NDc3YjY0OGRhOTE4NDIwNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGM0ODRjYmI0OWNhNGJjZjc4Y2Q5YTRlNGRmYjgzYzNiM2QyZWViYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTllYmUzMjgxMGE0Y2IyYjE0NzRiMDhlMzQzYzFkYzlkYjA3ZGMxODMyMDc1
|
10
|
+
M2YyMmJiZTY5ZTVhMDk3NDhlYTYxMjg4ZTM5Y2E2MTVlZTAzMmE1MzQ1NmJk
|
11
|
+
ODkwYzQ4YjgyM2FkZmNhN2M0MDk1MzNjZGEyNzQ3ZTAyN2FmOTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTYxNGE5ZWQ0ZmU4MGI5M2Y2ZDZkYmJlMmIwNjllNmMwOGFkZTA2ODBjNzIz
|
14
|
+
ZDdmZGQ1MWJjZDY2N2QyZjMwNzc4ODgzODAyMDNkMDVkMGI2NjZmN2IzNzE5
|
15
|
+
NTQ3ZjQ1MjI4NjRhYjljNzFjNzZiZWQzZjIyZGRlNjdhNzNiMGQ=
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'timeout'
|
2
|
-
|
3
1
|
# This is a useful blog post:
|
4
2
|
# http://blog.robseaman.com/2008/12/12/sending-ctrl-c-to-a-subprocess-with-ruby
|
5
3
|
|
@@ -42,15 +40,23 @@ module TurbotRunner
|
|
42
40
|
# then the incomplete line will be read, causing chaos down the line.
|
43
41
|
line = ''
|
44
42
|
|
43
|
+
time_of_last_read = Time.now
|
44
|
+
|
45
45
|
until @interrupted do
|
46
46
|
byte = f.read(1)
|
47
47
|
if byte.nil?
|
48
|
-
|
49
|
-
|
48
|
+
if script_thread.alive?
|
49
|
+
sleep 0.1
|
50
|
+
interrupt_and_mark_as_failed if (Time.now - time_of_last_read) > @timeout
|
51
|
+
else
|
52
|
+
break
|
53
|
+
end
|
50
54
|
elsif byte == "\n"
|
51
55
|
@processor.process(line)
|
56
|
+
time_of_last_read = Time.now
|
52
57
|
line = ''
|
53
58
|
else
|
59
|
+
time_of_last_read = Time.now
|
54
60
|
line << byte
|
55
61
|
end
|
56
62
|
end
|
@@ -75,18 +81,11 @@ module TurbotRunner
|
|
75
81
|
|
76
82
|
private
|
77
83
|
def run_command(command)
|
78
|
-
|
79
|
-
Timeout::timeout(@timeout) do
|
80
|
-
system(command)
|
84
|
+
system(command)
|
81
85
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
rescue Timeout::Error
|
87
|
-
kill_running_processes
|
88
|
-
false
|
89
|
-
end
|
86
|
+
# A nil exitstatus indicates that the script was interrupted. A
|
87
|
+
# termsig of 2 indicates that the script was interrupted by a SIGINT.
|
88
|
+
$?.exitstatus == 0 || ($?.exitstatus.nil? && $?.termsig == 2)
|
90
89
|
end
|
91
90
|
|
92
91
|
def kill_running_processes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbot-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenCorporates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|