Commit 76da0626 by David Trowbridge

Merge pull request #541 from davidt/compiler-stdout-unbound

Fix an UnboundLocalError if a compiler fails.
parents 0db06ec1 d0d53a4e
...@@ -111,6 +111,7 @@ class SubProcessCompiler(CompilerBase): ...@@ -111,6 +111,7 @@ class SubProcessCompiler(CompilerBase):
else: else:
argument_list.extend(flattening_arg) argument_list.extend(flattening_arg)
stdout = None
try: try:
# We always catch stdout in a file, but we may not have a use for it. # We always catch stdout in a file, but we may not have a use for it.
temp_file_container = cwd or os.path.dirname(stdout_captured or "") or os.getcwd() temp_file_container = cwd or os.path.dirname(stdout_captured or "") or os.getcwd()
...@@ -135,7 +136,8 @@ class SubProcessCompiler(CompilerBase): ...@@ -135,7 +136,8 @@ class SubProcessCompiler(CompilerBase):
raise CompilerError(e) raise CompilerError(e)
finally: finally:
# Decide what to do with captured stdout. # Decide what to do with captured stdout.
if stdout_captured: if stdout:
os.rename(stdout.name, os.path.join(cwd or os.curdir, stdout_captured)) if stdout_captured:
else: os.rename(stdout.name, os.path.join(cwd or os.curdir, stdout_captured))
os.remove(stdout.name) else:
os.remove(stdout.name)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment