summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amqp_codegen.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/amqp_codegen.py b/amqp_codegen.py
index ff00c8b5..06c772a6 100644
--- a/amqp_codegen.py
+++ b/amqp_codegen.py
@@ -179,11 +179,12 @@ def do_main(header_fn,body_fn):
stdout = sys.stdout
f = open(out_file, 'w')
try:
- sys.stdout = f
- fn(amqp_spec)
- except:
- remove(out_file)
- raise
+ try:
+ sys.stdout = f
+ fn(amqp_spec)
+ except:
+ remove(out_file)
+ raise
finally:
sys.stdout = stdout
f.close()