mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
fix npm installed command
This commit is contained in:
parent
e254cbc764
commit
ca2b378ed5
@ -98,15 +98,18 @@ def install(pkg=None,
|
||||
lines = npm_output.splitlines()
|
||||
log.error(lines)
|
||||
|
||||
# Strip all lines until JSON output starts
|
||||
while not lines[0].startswith('{') and not lines[0].startswith('['):
|
||||
lines = lines[1:]
|
||||
while lines:
|
||||
# Strip all lines until JSON output starts
|
||||
while not lines[0].startswith('{') and not lines[0].startswith('['):
|
||||
lines = lines[1:]
|
||||
|
||||
try:
|
||||
return json.loads(''.join(lines))
|
||||
except ValueError:
|
||||
# Still no JSON!! Return the stdout as a string
|
||||
return npm_output
|
||||
try:
|
||||
return json.loads(''.join(lines))
|
||||
except ValueError:
|
||||
lines = lines[1:]
|
||||
|
||||
# Still no JSON!! Return the stdout as a string
|
||||
return npm_output
|
||||
|
||||
|
||||
def uninstall(pkg,
|
||||
|
@ -129,7 +129,7 @@ def installed(name,
|
||||
ret['comment'] = 'Error installing \'{0}\': {1}'.format(name, err)
|
||||
return ret
|
||||
|
||||
if call or isinstance(call, list) or isinstance(call, dict):
|
||||
if call and (isinstance(call, list) or isinstance(call, dict)):
|
||||
ret['result'] = True
|
||||
version = call[0]['version']
|
||||
pkg_name = call[0]['name']
|
||||
|
Loading…
Reference in New Issue
Block a user