Skip to content

Commit 89e7dc6

Browse files
committed
Land rapid7#5499, polish dem spinners
2 parents df6722c + fe09d98 commit 89e7dc6

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lib/metasploit/framework/command/console.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,21 @@ def spinner
1919
return if Rex::Compat.is_cygwin
2020
return if $msf_spinner_thread
2121
$msf_spinner_thread = Thread.new do
22-
$stderr.print "[*] Starting the Metasploit Framework console..."
22+
base_line = "[*] Starting the Metasploit Framework console..."
23+
cycle = 0
2324
loop do
2425
%q{/-\|}.each_char do |c|
25-
$stderr.print c
26-
$stderr.print "\b"
26+
status = "#{base_line}#{c}\r"
27+
cycle += 1
28+
off = cycle % base_line.length
29+
case status[off, 1]
30+
when /[a-z]/
31+
status[off, 1] = status[off, 1].upcase
32+
when /[A-Z]/
33+
status[off, 1] = status[off, 1].downcase
34+
end
35+
$stderr.print status
36+
::IO.select(nil, nil, nil, 0.10)
2737
end
2838
end
2939
end

lib/msf/ui/console/driver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def on_startup(opts = {})
547547

548548
if $msf_spinner_thread
549549
$msf_spinner_thread.kill
550-
$stderr.print "\n"
550+
$stderr.print "\r" + (" " * 60) + "\n"
551551
end
552552

553553
run_single("banner") unless opts['DisableBanner']

0 commit comments

Comments
 (0)