Skip to content

Instantly share code, notes, and snippets.

@alandotcom
Last active December 24, 2015 07:49
Show Gist options
  • Select an option

  • Save alandotcom/6766423 to your computer and use it in GitHub Desktop.

Select an option

Save alandotcom/6766423 to your computer and use it in GitHub Desktop.
Watching long running commands in OSX

Install terminal-notifier

$ gem install terminal-notifier

Then add a new function into your .bashrc or .zshrc

function watch { 
  $* 
  echo -n -e "\033[41m"
  echo $* DONE  
  date
  echo -n -e "\033[0m" 
  $(rvm @default ; echo $* DONE | terminal-notifier)
}

The last line launches a sub-shell, switches to the correct Ruby and gemset and launches terminal-notifier. RVM is not required (just Ruby 1.9.3).

Now I can do something like:

$ watch rake run_a_really_long_test_suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment