Skip to content

Commit

Permalink
Fix Process.exec spec failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Apr 3, 2012
1 parent 717d560 commit 09f2432
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 22 deletions.
5 changes: 3 additions & 2 deletions kernel/common/process18.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ module Process
def self.exec(cmd, *args) def self.exec(cmd, *args)
if args.empty? and cmd.kind_of? String if args.empty? and cmd.kind_of? String
raise Errno::ENOENT if cmd.empty? 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] Process.perform_exec "/bin/sh", ["sh", "-c", cmd]
else else
Process.perform_exec cmd, [cmd] args = cmd.split(' ')
Process.perform_exec args.first, args
end end
else else
if cmd.kind_of? Array if cmd.kind_of? Array
Expand Down
5 changes: 3 additions & 2 deletions kernel/common/process19.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ def self.exec(environment_or_cmd, *args)


if args.empty? and cmd.kind_of? String if args.empty? and cmd.kind_of? String
raise Errno::ENOENT if cmd.empty? 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] Process.perform_exec "/bin/sh", ["sh", "-c", cmd]
else else
Process.perform_exec cmd, [cmd] args = cmd.split(' ')
Process.perform_exec args.first, args
end end
else else
if cmd.kind_of? Array if cmd.kind_of? Array
Expand Down
6 changes: 0 additions & 6 deletions spec/tags/18/ruby/core/kernel/exec_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/tags/18/ruby/core/process/exec_tags.txt

This file was deleted.

6 changes: 0 additions & 6 deletions spec/tags/19/ruby/core/kernel/exec_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/tags/19/ruby/core/process/exec_tags.txt

This file was deleted.

0 comments on commit 09f2432

Please sign in to comment.