rexec 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeac2d77b24b91623ceb1e3ba60b8241458e99ab
4
- data.tar.gz: 8139f4e5be7d952b8c852515b44e15ef8f7414c4
3
+ metadata.gz: e811d7d75e4759902a1c69dc41abd0c71b31c86f
4
+ data.tar.gz: 6bbc0bf83c1fed8e566d31ecefd3a2210989e813
5
5
  SHA512:
6
- metadata.gz: 858b77f57fad5dc074c993bc36a68831bd48d9975c472ad7f0d2855c1c9da8f1bc4422c703aa1f649eb352f1a0e23e22fa33d3e2b8e52d13e16c3b149b7b1193
7
- data.tar.gz: 957c3d06a7632c233a71509e01f7ff39a83734f264556f61c2f8f5b4e99d462babf825fcadc15ceff0256c9ccc16568a9efd527cb4b428e89ff5b05ae6382d96
6
+ metadata.gz: e832c5874f56ff603431ebd9d3f2aa5fcfa29cf20a31dd44ebc3240cb01cb71202fac639aa0d3ada607ae37e366654163bc2d9095038968ff2c130fcd12de03e
7
+ data.tar.gz: 5e7d867d3b05be1642c78768d1d765d10d01b70f06c028c0ed24b74848abf82b4f086203edb469c0e4ca8b0081ae6fa28288680f15358862febe394f2470f611
@@ -3,5 +3,6 @@ rvm:
3
3
  - "1.8.7"
4
4
  - "1.9.2"
5
5
  - "1.9.3"
6
+ - "2.0"
6
7
  - rbx-18mode
7
8
  - rbx-19mode
@@ -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
- if options[:env!]
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
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module RExec
22
- VERSION = "1.5.2"
22
+ VERSION = "1.6.0"
23
23
  end
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.5.2
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-08-18 00:00:00.000000000 Z
11
+ date: 2013-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler