summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-20 19:36:52 +0000
committerwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-20 19:36:52 +0000
commitc34072460ae81c328780bdb54a64e867c2579871 (patch)
tree923691c07a4cb8d4a3d856be15cc382d68062e78
parentd6cca5a5dc2a42151b2a4d3406544b8f76eec689 (diff)
Backport #145 [ruby-dev:35075]; Fixes some misleading exceptions in IRB's fg command when used with no arguments or invalid arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@27934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/irb/ext/multi-irb.rb8
-rw-r--r--lib/irb/extend-command.rb10
3 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b285c90da..cc5375e423 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu May 20 04:10:00 2010 Kirk Haines <khaines@ruby-lang.org>
+
+ * lib/cgi.rb: Backport #229 [ruby-core:17634]; CGI::Cookie objects can get out of sync when CGI::Cookie#value= is used to assign a new value. Also, if a nil value ends up in the array of values for the cookie, CGI::Cookie#to_s would blow up on a gsub error when it tried to CGI::escape the nil value. This is fixed so that nils are treated as empty strings.
+
+ * lib/irb/ext/multi-irb.rb: Backport #145 [ruby-dev:35075]; Fixes some misleading exceptions in IRB's fg command when used with no arguments or invalid arguments.
+ * lib/irb/extended-command.rb: Backport #145 [ruby-dev:35075]
+
Fri Mar 5 03:58:00 2010 Kirk Haines <khaines@ruby-lang.org>
* lib/yaml/tag.rb: Add a :startdoc: at the end of the YAML specific Module functions so that the rest of the Module docs get generated. Fixes Bug #1718 [ruby-core:24121].
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 4589b1d554..320ed04e4c 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 8994f2f8d2..c81e38cba4 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -126,9 +126,15 @@ 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