Skip to content
Browse files

Be more resilient if no tmux session is running.

This also requires that you use the patch from here
nightscape/tmux-ruby@e02dd79
on tmux-ruby
  • Loading branch information...
1 parent 4b0c631 commit 5a159177e19f0a80d887f23bdc111b7503e850be @nightscape nightscape committed Nov 9, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/tmuxbar.rb
View
13 lib/tmuxbar.rb
@@ -10,7 +10,7 @@ def start(example_count)
def stop
super
- @session.status_bar.right.pop_widget(@bar)
+ @session.status_bar.right.pop_widget(@bar) if @session
end
def example_passed(example)
@@ -43,15 +43,16 @@ def message(message)
private
def increment_bar
- @bar.value += 1
+ @bar.value += 1 if @bar
end
def init_bar(size)
server = Tmux::Server.new
- @session = server.sessions(attached: true).first
+ if (@session = server.sessions(attached: true).first)
- @bar = Tmux::Widgets::ProgressBar.new("RSpec")
- @bar.total = size
- @session.status_bar.right.add_widget(@bar)
+ @bar = Tmux::Widgets::ProgressBar.new("RSpec")
+ @bar.total = size
+ @session.status_bar.right.add_widget(@bar)
+ end
end
end

0 comments on commit 5a15917

Please sign in to comment.
Something went wrong with that request. Please try again.