1 parent 5a02aef commit 3a9ce0fCopy full SHA for 3a9ce0f
1 file changed
scripts/fitdump
@@ -107,12 +107,17 @@ def main(args=None):
107
as_dict=options.as_dict
108
)
109
110
- if options.type == "json":
111
- json.dump(records, fp=options.output, cls=RecordJSONEncoder)
112
- elif options.type == "readable":
113
- options.output.writelines(format_message(n, record, options)
114
- for n, record in enumerate(records, 1))
115
-
+ try:
+ if options.type == "json":
+ json.dump(records, fp=options.output, cls=RecordJSONEncoder)
+ elif options.type == "readable":
+ options.output.writelines(format_message(n, record, options)
+ for n, record in enumerate(records, 1))
116
+ finally:
117
118
+ options.output.close()
119
+ except IOError:
120
+ pass
121
122
if __name__ == '__main__':
123
try:
0 commit comments