subexec 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/subexec.rb +4 -2
- metadata +4 -12
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/subexec.rb
CHANGED
@@ -33,6 +33,7 @@ class Subexec
|
|
33
33
|
attr_accessor :timer
|
34
34
|
attr_accessor :output
|
35
35
|
attr_accessor :exitstatus
|
36
|
+
attr_accessor :lang
|
36
37
|
|
37
38
|
def self.run(command, options={})
|
38
39
|
sub = new(command, options)
|
@@ -43,6 +44,7 @@ class Subexec
|
|
43
44
|
def initialize(command, options={})
|
44
45
|
self.command = command
|
45
46
|
self.timeout = options[:timeout] || -1 # default is to never timeout
|
47
|
+
self.lang = options[:lang] || "C"
|
46
48
|
end
|
47
49
|
|
48
50
|
def run!
|
@@ -58,7 +60,7 @@ class Subexec
|
|
58
60
|
|
59
61
|
def spawn
|
60
62
|
r, w = IO.pipe
|
61
|
-
self.pid = Process.spawn(command, STDERR=>w, STDOUT=>w)
|
63
|
+
self.pid = Process.spawn({'LANG' => self.lang}, command, STDERR=>w, STDOUT=>w)
|
62
64
|
w.close
|
63
65
|
|
64
66
|
self.timer = Time.now + timeout
|
@@ -95,7 +97,7 @@ class Subexec
|
|
95
97
|
end
|
96
98
|
|
97
99
|
def exec
|
98
|
-
self.output =
|
100
|
+
self.output = `export LANG=#{lang} && #{command} 2>&1`
|
99
101
|
self.exitstatus = $?.exitstatus
|
100
102
|
end
|
101
103
|
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subexec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Peter Kieltyka
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-03-03 00:00:00 -05:00
|
18
14
|
default_executable:
|
19
15
|
dependencies: []
|
20
16
|
|
@@ -45,21 +41,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
41
|
requirements:
|
46
42
|
- - ">="
|
47
43
|
- !ruby/object:Gem::Version
|
48
|
-
segments:
|
49
|
-
- 0
|
50
44
|
version: "0"
|
51
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
46
|
none: false
|
53
47
|
requirements:
|
54
48
|
- - ">="
|
55
49
|
- !ruby/object:Gem::Version
|
56
|
-
segments:
|
57
|
-
- 0
|
58
50
|
version: "0"
|
59
51
|
requirements: []
|
60
52
|
|
61
53
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.3
|
54
|
+
rubygems_version: 1.5.3
|
63
55
|
signing_key:
|
64
56
|
specification_version: 3
|
65
57
|
summary: Subexec spawns an external command with a timeout
|