Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix Process.exec spec failures

  • Loading branch information...
commit 09f24321e79f720d6b8685805f7906b42f807732 1 parent 717d560
John Firebaugh authored
5 kernel/common/process18.rb
@@ -2,10 +2,11 @@ module Process
2 2 def self.exec(cmd, *args)
3 3 if args.empty? and cmd.kind_of? String
4 4 raise Errno::ENOENT if cmd.empty?
5   - if /([*?{}\[\]<>()~&|$;'`"\n\s]|[^\w-])/o.match(cmd)
  5 + if /([*?{}\[\]<>()~&|$;'`"\n])/o.match(cmd)
6 6 Process.perform_exec "/bin/sh", ["sh", "-c", cmd]
7 7 else
8   - Process.perform_exec cmd, [cmd]
  8 + args = cmd.split(' ')
  9 + Process.perform_exec args.first, args
9 10 end
10 11 else
11 12 if cmd.kind_of? Array
5 kernel/common/process19.rb
@@ -32,10 +32,11 @@ def self.exec(environment_or_cmd, *args)
32 32
33 33 if args.empty? and cmd.kind_of? String
34 34 raise Errno::ENOENT if cmd.empty?
35   - if /([*?{}\[\]<>()~&|$;'`"\n\s]|[^\w-])/o.match(cmd)
  35 + if /([*?{}\[\]<>()~&|$;'`"\n])/o.match(cmd)
36 36 Process.perform_exec "/bin/sh", ["sh", "-c", cmd]
37 37 else
38   - Process.perform_exec cmd, [cmd]
  38 + args = cmd.split(' ')
  39 + Process.perform_exec args.first, args
39 40 end
40 41 else
41 42 if cmd.kind_of? Array
6 spec/tags/18/ruby/core/kernel/exec_tags.txt
... ... @@ -1,6 +0,0 @@
1   -fails:Kernel#exec raises Errno::ENOENT for a command which does not exist
2   -fails:Kernel#exec raises Errno::EACCES when the file does not have execute permissions
3   -fails:Kernel#exec raises Errno::EACCES when passed a directory
4   -fails:Kernel.exec raises Errno::ENOENT for a command which does not exist
5   -fails:Kernel.exec raises Errno::EACCES when the file does not have execute permissions
6   -fails:Kernel.exec raises Errno::EACCES when passed a directory
3  spec/tags/18/ruby/core/process/exec_tags.txt
... ... @@ -1,3 +0,0 @@
1   -fails:Process.exec raises Errno::ENOENT for a command which does not exist
2   -fails:Process.exec raises Errno::EACCES when the file does not have execute permissions
3   -fails:Process.exec raises Errno::EACCES when passed a directory
6 spec/tags/19/ruby/core/kernel/exec_tags.txt
... ... @@ -1,6 +0,0 @@
1   -fails:Kernel#exec raises Errno::ENOENT for a command which does not exist
2   -fails:Kernel#exec raises Errno::EACCES when the file does not have execute permissions
3   -fails:Kernel#exec raises Errno::EACCES when passed a directory
4   -fails:Kernel.exec raises Errno::ENOENT for a command which does not exist
5   -fails:Kernel.exec raises Errno::EACCES when the file does not have execute permissions
6   -fails:Kernel.exec raises Errno::EACCES when passed a directory
3  spec/tags/19/ruby/core/process/exec_tags.txt
... ... @@ -1,3 +0,0 @@
1   -fails:Process.exec raises Errno::ENOENT for a command which does not exist
2   -fails:Process.exec raises Errno::EACCES when the file does not have execute permissions
3   -fails:Process.exec raises Errno::EACCES when passed a directory

0 comments on commit 09f2432

Please sign in to comment.
Something went wrong with that request. Please try again.