rexec 1.5.2 → 1.6.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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/lib/rexec/task.rb +25 -20
- data/lib/rexec/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: e811d7d75e4759902a1c69dc41abd0c71b31c86f
|
4
|
+
data.tar.gz: 6bbc0bf83c1fed8e566d31ecefd3a2210989e813
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e832c5874f56ff603431ebd9d3f2aa5fcfa29cf20a31dd44ebc3240cb01cb71202fac639aa0d3ada607ae37e366654163bc2d9095038968ff2c130fcd12de03e
|
7
|
+
data.tar.gz: 5e7d867d3b05be1642c78768d1d765d10d01b70f06c028c0ed24b74848abf82b4f086203edb469c0e4ca8b0081ae6fa28288680f15358862febe394f2470f611
|
data/.travis.yml
CHANGED
data/lib/rexec/task.rb
CHANGED
@@ -115,6 +115,27 @@ module RExec
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
def self.prepare_child_environment(command, options)
|
119
|
+
if options[:env!]
|
120
|
+
ENV.clear
|
121
|
+
ENV.update(options[:env!])
|
122
|
+
elsif options[:env]
|
123
|
+
ENV.update(options[:env])
|
124
|
+
end
|
125
|
+
|
126
|
+
if options[:umask]
|
127
|
+
File.umask(options[:umask])
|
128
|
+
end
|
129
|
+
|
130
|
+
if options[:chdir]
|
131
|
+
Dir.chdir(options[:chdir])
|
132
|
+
end
|
133
|
+
|
134
|
+
if options[:preflight]
|
135
|
+
preflight.call(command, options)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
118
139
|
public
|
119
140
|
# Returns true if the given pid is a current process
|
120
141
|
def self.running?(pid)
|
@@ -265,30 +286,11 @@ module RExec
|
|
265
286
|
STDOUT.reopen(cout[WR]) if cout[WR]
|
266
287
|
STDERR.reopen(cerr[WR]) if cerr[WR]
|
267
288
|
|
268
|
-
|
269
|
-
ENV.clear
|
270
|
-
ENV.update(options[:env!])
|
271
|
-
elsif options[:env]
|
272
|
-
ENV.update(options[:env])
|
273
|
-
end
|
274
|
-
|
275
|
-
if options[:umask]
|
276
|
-
File.umask(options[:umask])
|
277
|
-
end
|
278
|
-
|
279
|
-
if options[:chdir]
|
280
|
-
Dir.chdir(options[:chdir])
|
281
|
-
end
|
282
|
-
|
283
|
-
if options[:preflight]
|
284
|
-
preflight.call(command, options)
|
285
|
-
end
|
289
|
+
prepare_child_environment(command, options)
|
286
290
|
|
287
291
|
if command.respond_to? :call
|
288
292
|
command.call
|
289
293
|
elsif Array === command
|
290
|
-
command = command.dup
|
291
|
-
|
292
294
|
# If command is a Pathname, we need to convert it to an absolute path if possible,
|
293
295
|
# otherwise if it is relative it might cause problems.
|
294
296
|
if command[0].respond_to? :realpath
|
@@ -298,6 +300,9 @@ module RExec
|
|
298
300
|
# exec expects an array of Strings:
|
299
301
|
command.collect! { |item| item.to_s }
|
300
302
|
|
303
|
+
# Ensure that we DON'T use the shell for execution:
|
304
|
+
command[0] = [command[0], command[0]]
|
305
|
+
|
301
306
|
exec *command
|
302
307
|
else
|
303
308
|
if command.respond_to? :realpath
|
data/lib/rexec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|