Skip to content

Commit

Permalink
Just print each result on one line. Don't use curses
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Mar 25, 2009
1 parent ad9c4e6 commit 52a7231
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions lib/nginx_stat.rb
Expand Up @@ -29,17 +29,17 @@ def self.start(*args)

stats = []

if args.length > 1 and not defined? Curses then
$stderr.puts "Multiple logfile support requires curses"
exit 1
end

if defined? Curses then
Curses.init_screen
Curses.clear
Curses.addstr "Collecting data...\n"
Curses.refresh
end
# if args.length > 1 and not defined? Curses then
# $stderr.puts "Multiple logfile support requires curses"
# exit 1
# end

# if defined? Curses then
# Curses.init_screen
# Curses.clear
# Curses.addstr "Collecting data...\n"
# Curses.refresh
# end

args.each_with_index do |filename, offset|
stat = self.new File.open(filename), interval, offset
Expand Down Expand Up @@ -91,19 +91,19 @@ def start
end

def print
if defined? Curses then
Curses.setpos @offset, 0
Curses.addstr ' ' * @last_len
Curses.setpos @offset, 0
Curses.addstr "#{@io_path}\t#{@status}"
Curses.refresh
else
print "\r"
print ' ' * @last_len
print "\r"
print @status
# if defined? Curses then
# Curses.setpos @offset, 0
# Curses.addstr ' ' * @last_len
# Curses.setpos @offset, 0
# Curses.addstr "#{@io_path}\t#{@status}"
# Curses.refresh
# else
# print "\r"
# print ' ' * @last_len
# print "\r"
puts @status
$stdout.flush
end
# end
end

private
Expand Down

0 comments on commit 52a7231

Please sign in to comment.