Skip to content

Commit 98c387c

Browse files
author
HD Moore
committed
Merge pull request rapid7#886 from todb-r7/fix-msfupdate
Fix msfupdate for rapid7#7297
2 parents 9a0a063 + 09f3426 commit 98c387c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

msfupdate

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,27 @@ end
2828

2929
@args.each_with_index do |arg,i|
3030
case arg
31-
when "wait"
31+
# Handle the old wait/nowait argument behavior
32+
when "wait", "nowait"
3233
@wait_index = i
33-
when /--config-dir/
34+
@actually_wait = (arg == "wait")
35+
# An empty or absent config-dir means a default config-dir
36+
when "--config-dir"
37+
@configdir_index = i
38+
# A defined config dir means a defined config-dir
39+
when /--config-dir=(.*)?/
3440
# Spaces in the directory should be fine since this whole thing is passed
3541
# as a single argument via the multi-arg syntax for system() below.
3642
# TODO: Test this spaces business. I don't buy it. -todb
43+
@configdir = $1
3744
@configdir_index = i
3845
end
3946
end
4047

41-
@args.delete_at @wait_index if @wait_index
42-
@args.push("--config-dir=#{@configdir}") unless @configdir_index
48+
@args[@wait_index] = nil if @wait_index
49+
@args[@configdir_index] = nil if @configdir_index
50+
@args = @args.compact
51+
@args.push("--config-dir=#{@configdir}")
4352
@args.push("--non-interactive")
4453

4554
res = system("svn", "cleanup")
@@ -54,7 +63,7 @@ else
5463
system("svn", "update", *@args)
5564
end
5665

57-
if @wait_index
66+
if @actually_wait
5867
$stderr.puts ""
5968
$stderr.puts "[*] Please hit enter to exit"
6069
$stderr.puts ""

0 commit comments

Comments
 (0)