diff options
author | Johnny Chen <johnny.chen@apple.com> | 2010-10-14 16:57:08 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2010-10-14 16:57:08 +0000 |
commit | 7518ff0ddac976dba54a7aa3bcd84081c5cfd882 (patch) | |
tree | df2b34d1276993328590f9fc16444194ff381881 /lldb/scripts/Python/append-debugger-id.py | |
parent | cd8b2bbed2f5164791478806015addeaaddebbba (diff) | |
download | bcm5719-llvm-7518ff0ddac976dba54a7aa3bcd84081c5cfd882.tar.gz bcm5719-llvm-7518ff0ddac976dba54a7aa3bcd84081c5cfd882.zip |
Wrap the file writing operations inside a with statement to simplify code.
llvm-svn: 116486
Diffstat (limited to 'lldb/scripts/Python/append-debugger-id.py')
-rw-r--r-- | lldb/scripts/Python/append-debugger-id.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lldb/scripts/Python/append-debugger-id.py b/lldb/scripts/Python/append-debugger-id.py index 474443a0c89..e1e3628157e 100644 --- a/lldb/scripts/Python/append-debugger-id.py +++ b/lldb/scripts/Python/append-debugger-id.py @@ -18,14 +18,6 @@ else: # print "output_name is '" + output_name + "'" -try: - f_out = open (output_name, 'a') -except IOError: - print "Error: Unable to open file for appending: " + output_name -else: - f_out.write ("debugger_unique_id = 0\n"); - f_out.write ("SBDebugger.Initialize()\n"); - try: - f_out.close() - except IOError: - print "Error occurred while close file." +with open(output_name, 'a') as f_out: + f_out.write("debugger_unique_id = 0\n") + f_out.write("SBDebugger.Initialize()\n") |