Provide a better exception when spidermonkey exits abormally

This commit is contained in:
Kumar McMillan 2010-12-10 02:54:41 +08:00 коммит произвёл Matt Basta
Родитель b3b29b8836
Коммит 3b831df214
1 изменённых файлов: 5 добавлений и 3 удалений

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

@ -112,12 +112,14 @@ def _get_tree(name, code):
temp.write(data)
temp.flush() # This is very important
shell = subprocess.Popen([SPIDERMONKEY, "-f", temp.name],
cmd = [SPIDERMONKEY, "-f", temp.name]
shell = subprocess.Popen(cmd,
shell=False,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
results = shell.communicate()
data = results[0]
data, stderr = shell.communicate()
if stderr:
raise RuntimeError('Error calling %r: %s', (cmd, stderr))
# Closing the temp file will delete it.
temp.close()