jonleighton/poltergeist — pull request #154 by niklas (2012-09-15 16:33:28+00:00)
Title: detect browser by parsing $PATH env var

On my system, redirecting the output of `which` results in a success of the command, so the first item of BROWSERS is taken. In general, using `which` seems really unreliable for binary detection. So I stole a bit from mislav at Stackoverflow:

http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby

It may be a bit over the top (respecting PATHEXT), but better be save than sorry :)

This should satisfy #89