Skip to content

Commit c8ad8fc

Browse files
HAOCHENYECyCle1024
authored andcommitted
[Fix] add exception handling in LogCapture.__exit__
1 parent c3d9a36 commit c8ad8fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

xtuner/_testing/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ def __enter__(self):
4444
return self
4545

4646
def __exit__(self, exc_type, exc_value, traceback):
47-
self._logger.remove(self._handle_id)
47+
try:
48+
self._logger.remove(self._handle_id)
49+
except KeyboardInterrupt as e:
50+
raise e
51+
except:
52+
...
4853

4954
def get_output(self) -> str:
5055
self._handle.seek(0)

0 commit comments

Comments
 (0)