diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 12:21:11 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 12:21:11 +0000 |
commit | cb04cd4423466f5932718077efdcedf1da41495d (patch) | |
tree | 0b33fb720ebfa2967055af4abb5f3bd6c23dd517 /lib/shell/command-processor.rb | |
parent | 582c53a647ed8531e7ecb231d70722c751e0d347 (diff) | |
download | ruby-cb04cd4423466f5932718077efdcedf1da41495d.tar.gz ruby-cb04cd4423466f5932718077efdcedf1da41495d.tar.xz ruby-cb04cd4423466f5932718077efdcedf1da41495d.zip |
* lib/shell/*: bug fix for Shell#system(command_line_string).
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/shell/command-processor.rb')
-rw-r--r-- | lib/shell/command-processor.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb index ce5102a9c..6f8e5ffd0 100644 --- a/lib/shell/command-processor.rb +++ b/lib/shell/command-processor.rb @@ -21,6 +21,7 @@ require "shell/builtin-command" class Shell class CommandProcessor +# include Error # # initialize of Shell and related classes. @@ -220,6 +221,13 @@ class Shell # sh.system("ls", "-l") | sh.head > STDOUT # def system(command, *opts) + if opts.empty? + if command =~ /\*|\?|\{|\}|\[|\]|<|>|\(|\)|~|&|\||\\|\$|;|'|`|"|\n/ + return SystemCommand.new(@shell, find_system_command("sh"), "-c", command) + else + command, *opts = command.split(/\s+/) + end + end SystemCommand.new(@shell, find_system_command(command), *opts) end @@ -277,7 +285,7 @@ class Shell when IO AppendIO.new(@shell, to, filter) else - Shell.Fail CantApplyMethod, "append", to.class + Shell.Fail Error::CantApplyMethod, "append", to.class end end @@ -327,10 +335,10 @@ class Shell if exists?(path) return path else - Shell.Fail CommandNotFound, command + Shell.Fail Error::CommandNotFound, command end when false - Shell.Fail CommandNotFound, command + Shell.Fail Error::CommandNotFound, command end for p in @shell.system_path @@ -341,7 +349,7 @@ class Shell end end @system_commands[command] = false - Shell.Fail CommandNotFound, command + Shell.Fail Error::CommandNotFound, command end # |