fix(bin/linja): which does not look for 'sbin'

Ubuntu-12/14 has two packages which provide a binary file `ninja`:

 1. ninja : http://forkbomb.org/ninja/
 2. ninja-build : http://martine.github.io/ninja/

We had a case where a user has ninja installed instead of ninja-build,
then linja confuses that it has ninja-build and tries to use it.

This commit excludes a directory whose name includes "sbin" in finding a
system program. As a result, `which` will not find ninja[1] which
resides at /usr/sbin.
This commit is contained in:
Soonho Kong 2015-03-24 11:13:14 -04:00
parent 30e3049c56
commit d950338980

View file

@ -334,6 +334,8 @@ def which(program):
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
if "sbin" in path:
continue
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file