Skip to content
Browse files

Fix Process.exec spec failures

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