Bug 1262978: Run npm to get the path to installed binaries if eslint can't otherwise be found. r=gps

MozReview-Commit-ID: HFWID6QhpS2

--HG--
extra : rebase_source : bed90ecf7b59b348ec5047c9ac9e8cc31a2aa193
extra : amend_source : 97f81e0bb34098c1aaad1b2ad4355d3f0ad6f72c
This commit is contained in:
Dave Townsend 2016-04-07 13:18:40 -07:00
Родитель c515d4ce79
Коммит f2c61524b0
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -166,7 +166,18 @@ class MachCommands(MachCommandBase):
try:
binary = which.which('eslint')
except which.WhichError:
pass
npmPath = self.getNodeOrNpmPath("npm")
if npmPath:
try:
output = subprocess.check_output([npmPath, "bin", "-g"],
stderr=subprocess.STDOUT)
if minversion:
base = output.split("\n").strip()
binary = os.path.join(base, "eslint")
if not os.path.is_file(binary):
binary = None
except (subprocess.CalledProcessError, WindowsError):
pass
if not binary:
print(ESLINT_NOT_FOUND_MESSAGE)