equal
deleted
inserted
replaced
107 if hasattr(ui, 'fout'): |
107 if hasattr(ui, 'fout'): |
108 assert ui is not None # help pytype |
108 assert ui is not None # help pytype |
109 assert ui.fout is not None # help pytype |
109 assert ui.fout is not None # help pytype |
110 try: |
110 try: |
111 ui.fout.flush() |
111 ui.fout.flush() |
112 except IOError as e: |
112 except OSError as e: |
113 err = e |
113 err = e |
114 status = -1 |
114 status = -1 |
115 |
115 |
116 if hasattr(ui, 'ferr'): |
116 if hasattr(ui, 'ferr'): |
117 assert ui is not None # help pytype |
117 assert ui is not None # help pytype |
122 b'abort: %s\n' % encoding.strtolocal(err.strerror) |
122 b'abort: %s\n' % encoding.strtolocal(err.strerror) |
123 ) |
123 ) |
124 ui.ferr.flush() |
124 ui.ferr.flush() |
125 # There's not much we can do about an I/O error here. So (possibly) |
125 # There's not much we can do about an I/O error here. So (possibly) |
126 # change the status code and move on. |
126 # change the status code and move on. |
127 except IOError: |
127 except OSError: |
128 status = -1 |
128 status = -1 |
129 |
129 |
130 return status |
130 return status |
131 |
131 |
132 |
132 |
206 continue |
206 continue |
207 # Check if the file is okay |
207 # Check if the file is okay |
208 try: |
208 try: |
209 fp.flush() |
209 fp.flush() |
210 continue |
210 continue |
211 except IOError: |
211 except OSError: |
212 pass |
212 pass |
213 # Otherwise mark it as closed to silence "Exception ignored in" |
213 # Otherwise mark it as closed to silence "Exception ignored in" |
214 # message emitted by the interpreter finalizer. |
214 # message emitted by the interpreter finalizer. |
215 try: |
215 try: |
216 fp.close() |
216 fp.close() |
217 except IOError: |
217 except OSError: |
218 pass |
218 pass |
219 |
219 |
220 |
220 |
221 def _formatargs(args): |
221 def _formatargs(args): |
222 return b' '.join(procutil.shellquote(a) for a in args) |
222 return b' '.join(procutil.shellquote(a) for a in args) |
498 ui.warn(b"(%s)\n" % error.similarity_hint(sim)) |
498 ui.warn(b"(%s)\n" % error.similarity_hint(sim)) |
499 suggested = True |
499 suggested = True |
500 if not suggested: |
500 if not suggested: |
501 ui.warn(nocmdmsg) |
501 ui.warn(nocmdmsg) |
502 ui.warn(_(b"(use 'hg help' for a list of commands)\n")) |
502 ui.warn(_(b"(use 'hg help' for a list of commands)\n")) |
503 except IOError: |
503 except OSError: |
504 raise |
504 raise |
505 except KeyboardInterrupt: |
505 except KeyboardInterrupt: |
506 raise |
506 raise |
507 except: # probably re-raises |
507 except: # probably re-raises |
508 if not handlecommandexception(ui): |
508 if not handlecommandexception(ui): |