diff options
Diffstat (limited to 'editor.py')
-rw-r--r-- | editor.py | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -106,11 +106,8 @@ least one of these before using this command.""", file=sys.stderr) | |||
106 | raise EditorError('editor failed with exit status %d: %s %s' | 106 | raise EditorError('editor failed with exit status %d: %s %s' |
107 | % (rc, editor, path)) | 107 | % (rc, editor, path)) |
108 | 108 | ||
109 | fd2 = open(path) | 109 | with open(path) as fd2: |
110 | try: | ||
111 | return fd2.read() | 110 | return fd2.read() |
112 | finally: | ||
113 | fd2.close() | ||
114 | finally: | 111 | finally: |
115 | if fd: | 112 | if fd: |
116 | os.close(fd) | 113 | os.close(fd) |