Remove invalid JSON for Mac OS X (#36167)

* Remove invalid JSON for Mac OS X

* Check for fsevents line and remove
This commit is contained in:
Shane Lee 2016-09-12 11:42:43 -06:00 committed by Nicole Thomas
parent 9ce4abefcd
commit 019ef1c47c

View File

@ -185,6 +185,11 @@ def _extract_json(npm_output):
lines = lines[1:]
while lines and not lines[-1].startswith('}') and not lines[-1].startswith(']'):
lines = lines[:-1]
# Mac OSX with fsevents includes the following line in the return
# when a new module is installed which is invalid JSON:
# [fsevents] Success: "..."
while lines and lines[0].startswith('[fsevents]'):
lines = lines[1:]
try:
return json.loads(''.join(lines))
except ValueError: