Small rework of the spinners, clear the line when done

bug/bundler_fix
HD Moore 2015-06-06 14:30:42 -05:00
parent dca2607d54
commit fe09d9888e
2 changed files with 14 additions and 4 deletions

View File

@ -19,11 +19,21 @@ class Metasploit::Framework::Command::Console < Metasploit::Framework::Command::
return if Rex::Compat.is_cygwin return if Rex::Compat.is_cygwin
return if $msf_spinner_thread return if $msf_spinner_thread
$msf_spinner_thread = Thread.new do $msf_spinner_thread = Thread.new do
$stderr.print "[*] Starting the Metasploit Framework console..." base_line = "[*] Starting the Metasploit Framework console..."
cycle = 0
loop do loop do
%q{/-\|}.each_char do |c| %q{/-\|}.each_char do |c|
$stderr.print c status = "#{base_line}#{c}\r"
$stderr.print "\b" cycle += 1
off = cycle % base_line.length
case status[off, 1]
when /[a-z]/
status[off, 1] = status[off, 1].upcase
when /[A-Z]/
status[off, 1] = status[off, 1].downcase
end
$stderr.print status
::IO.select(nil, nil, nil, 0.10)
end end
end end
end end

View File

@ -547,7 +547,7 @@ class Driver < Msf::Ui::Driver
if $msf_spinner_thread if $msf_spinner_thread
$msf_spinner_thread.kill $msf_spinner_thread.kill
$stderr.print "\n" $stderr.print "\r" + (" " * 60) + "\n"
end end
run_single("banner") unless opts['DisableBanner'] run_single("banner") unless opts['DisableBanner']