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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzI3NjZjMDc0NzI4Y2M5ZGRmMGY3YTQ2MzVkNWZhZTZkZDkwMjg5OQ==
4
+ OTU4OTExM2RjYzNhYjIwM2NiN2ZmYjU3NDc3YjY0OGRhOTE4NDIwNQ==
5
5
  data.tar.gz: !binary |-
6
- NjBiNDk0Mzc1NzdmODdiYjAxNzg4MWFhN2FlOGY1MzRmYzQ3NzY2NA==
6
+ NGM0ODRjYmI0OWNhNGJjZjc4Y2Q5YTRlNGRmYjgzYzNiM2QyZWViYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWY4ZDlhNjBmZjNhNDBmMDU0OWQwYWIyOTEyYTc4NzdmMzczMzkwMTVmYTE4
10
- NjUxMTRlOWNiNzlhZjc5ZGVjZmFhZjk4MzA4NjU3OThmZjU0ODViNzY2OGY3
11
- ODk2NTg3NzYxYTliNzJkZmIwNzU3NmQxNzdjMzUyM2VkMTU4YWQ=
9
+ MTllYmUzMjgxMGE0Y2IyYjE0NzRiMDhlMzQzYzFkYzlkYjA3ZGMxODMyMDc1
10
+ M2YyMmJiZTY5ZTVhMDk3NDhlYTYxMjg4ZTM5Y2E2MTVlZTAzMmE1MzQ1NmJk
11
+ ODkwYzQ4YjgyM2FkZmNhN2M0MDk1MzNjZGEyNzQ3ZTAyN2FmOTA=
12
12
  data.tar.gz: !binary |-
13
- YTIyYmIzZTI2NDkzODQxYjVmOTM2OTYwNGQ2ODQ5Y2QyMWZhZjE1MDZlZWJj
14
- NmFmOWFhYzVkMTVkMmRjNjQyZGY4YzVkOGQ5YmE1MTE0ZDMxMTI1Zjg4MGZk
15
- YTZhZWYzZGRmOWFjYWFmNTU1ZTNhNjdkYzhkNWQ0YWEzNTUxOTA=
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
- break unless script_thread.alive?
49
- sleep 0.1
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
- begin
79
- Timeout::timeout(@timeout) do
80
- system(command)
84
+ system(command)
81
85
 
82
- # A nil exitstatus indicates that the script was interrupted. A
83
- # termsig of 2 indicates that the script was interrupted by a SIGINT.
84
- $?.exitstatus == 0 || ($?.exitstatus.nil? && $?.termsig == 2)
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
@@ -1,3 +1,3 @@
1
1
  module TurbotRunner
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
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.6
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-13 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema