subcontractor 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,22 @@
1
1
  require 'optparse'
2
2
  require 'pty'
3
3
 
4
+ module SafePty
5
+ def self.spawn command, &block
6
+
7
+ PTY.spawn(command) do |r,w,p|
8
+ begin
9
+ yield r,w,p
10
+ rescue Errno::EIO
11
+ ensure
12
+ Process.wait p
13
+ end
14
+ end
15
+
16
+ $?.exitstatus
17
+ end
18
+ end
19
+
4
20
  module Subcontractor
5
21
  class CLI
6
22
 
@@ -9,7 +25,7 @@ module Subcontractor
9
25
  command = build_command(ARGV.dup, options)
10
26
  Dir.chdir(options[:chdir]) if options[:chdir]
11
27
  signal = options[:signal] || "TERM"
12
- PTY.spawn(command) do |stdin, stdout, pid|
28
+ SafePty.spawn(command) do |stdin, stdout, pid|
13
29
  trap("TERM") do
14
30
  send_kill(signal, find_pids_to_kill(pid))
15
31
  end
@@ -1,3 +1,3 @@
1
1
  module Subcontractor
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subcontractor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Pitluga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-19 00:00:00 Z
18
+ date: 2013-01-24 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: rvm aware process launcher for foreman