runScript should not crash Munki if the script it's attempting to run does not exist or there are other issues executing it.

This commit is contained in:
Justin McWilliams
2011-09-23 14:12:16 -04:00
parent 72dfa5bce0
commit 224db09684
+9 -4
View File
@@ -849,10 +849,15 @@ def runScript(itemname, path, scriptname):
% (scriptname, itemname))
scriptoutput = []
proc = subprocess.Popen(path, shell=False, bufsize=1,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
try:
proc = subprocess.Popen(path, shell=False, bufsize=1,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
except OSError, e:
munkicommon.display_error(
'Error executing script %s: %s' % (scriptname, str(e)))
return -1
while True:
msg = proc.stdout.readline().decode('UTF-8')