Skip to content

Commit

Permalink
notify: strip ANSI SGR escape codes from message
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Oct 5, 2011
1 parent 92b1e9e commit e8a876a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/test/loop/notify.rb
Expand Up @@ -5,8 +5,12 @@

unless run_status.success? or run_status.signaled?
title = 'FAIL at %s in %0.1fs' % [started_at.strftime('%r'), elapsed_time]
statistics = File.readlines(log_file).grep(/^\d+ \w+,/)
message = test_file + "\n" + statistics.join

stats = File.readlines(log_file).grep(/^\d+ \w+,/).join.
gsub(/\e\[\d+(;\d+)?m/, '') # strip ANSI SGR escape codes

message = test_file + "\n" + stats

Thread.new do # run in background
system 'notify-send', '-i', 'dialog-error', title, message or
system 'growlnotify', '-a', 'Xcode', '-m', message, title or
Expand Down

0 comments on commit e8a876a

Please sign in to comment.