Browse files

Deal with blank or missing config-dir better

Just deleting at an index will be surprising when you've already deleted
the wait/nowait. Use an Array#compact strategy instead.

Also, always define a sensible config-dir, even if none is given. If the
user wants to pass one especially, they can.

[FixRM #7297]
  • Loading branch information...
todb committed Oct 10, 2012
1 parent f247379 commit 09f34268d27936f06f753794d7173ed314602af8
Showing with 10 additions and 4 deletions.
  1. +10 −4 msfupdate
@@ -32,17 +32,23 @@ end
when "wait", "nowait"
@wait_index = i
@actually_wait = (arg == "wait")
- # Handle passing a config-dir especially
- when /--config-dir/
+ # An empty or absent config-dir means a default config-dir
+ when "--config-dir"
+ @configdir_index = i
+ # A defined config dir means a defined config-dir
+ when /--config-dir=(.*)?/
# Spaces in the directory should be fine since this whole thing is passed
# as a single argument via the multi-arg syntax for system() below.
# TODO: Test this spaces business. I don't buy it. -todb
+ @configdir = $1
@configdir_index = i
-@args.delete_at @wait_index if @wait_index
-@args.push("--config-dir=#{@configdir}") unless @configdir_index
+@args[@wait_index] = nil if @wait_index
+@args[@configdir_index] = nil if @configdir_index
+@args = @args.compact
res = system("svn", "cleanup")

0 comments on commit 09f3426

Please sign in to comment.