summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-17 06:51:29 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-17 06:51:29 +0000
commit29929d799d4da41a177feba7e0735b6b571dfa45 (patch)
treef34ad1de2e59129df3bc8844fd5d944f839ce706 /lib
parentd9abe0513d913b1eb6e149ad9f610a694385e226 (diff)
merge revision(s) 24911:
* lib/irb/ext/multi-irb.rb: Fix arguments handling for shell commands in irb; a patch by Yusuke Endoh [ruby-dev:35075] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@25814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/ext/multi-irb.rb8
-rw-r--r--lib/irb/extend-command.rb9
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 4589b1d554..634abbabf9 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -70,7 +70,7 @@ module IRB
end
def search(key)
- case key
+ job = case key
when Integer
@jobs[key]
when Irb
@@ -78,10 +78,10 @@ module IRB
when Thread
@jobs.assoc(key)
else
- assoc = @jobs.find{|k, v| v.context.main.equal?(key)}
- IRB.fail NoSuchJob, key if assoc.nil?
- assoc
+ @jobs.find{|k, v| v.context.main.equal?(key)}
end
+ IRB.fail NoSuchJob, key if job.nil?
+ job
end
def delete(key)
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 508721c11d..de797ab78b 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -126,9 +126,14 @@ module IRB
eval %[
def #{cmd_name}(*opts, &b)
require "#{load_file}"
+ arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
+ args = (1..arity.abs).map {|i| "arg" + i.to_s }
+ args << "*opts" if arity < 0
+ args << "&block"
+ args = args.join(", ")
eval %[
- def #{cmd_name}(*opts, &b)
- ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
+ def #{cmd_name}(\#{args})
+ ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
end
]
send :#{cmd_name}, *opts, &b