Skip to content

Commit 02fa1ef

Browse files
authored
Merge pull request #1607 from Bastian-Krause/bst/excepthook
remote: client: fix empty sys.excepthook error work around
2 parents e8aadae + 266fdde commit 02fa1ef

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

labgrid/remote/client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
from ..driver import Mode, ExecutionError
4949
from ..logging import basicConfig, StepLogger
5050

51+
# This is a workround for the gRPC issue
52+
# https://github.com/grpc/grpc/issues/38679.
53+
# Since Python 3.12, an empty exception message is printed from gRPC
54+
# during shutdown, although nothing seems to go wrong. As this is
55+
# confusing for users, suppress the message by adding an indirection.
56+
sys.excepthook = lambda type, value, traceback: sys.__excepthook__(type, value, traceback)
57+
5158

5259
class Error(Exception):
5360
pass
@@ -2169,13 +2176,6 @@ def main():
21692176
except Exception: # pylint: disable=broad-except
21702177
traceback.print_exc(file=sys.stderr)
21712178
exitcode = 2
2172-
if not args.debug:
2173-
# This is a workround for the gRPC issue
2174-
# https://github.com/grpc/grpc/issues/38679.
2175-
# Since Python 3.12, an empty exception message is printed from gRPC
2176-
# during shutdown, although nothing seems to go wrong. As this is
2177-
# confusing for users, suppress the message by closing stderr.
2178-
os.close(sys.stderr.fileno())
21792179
exit(exitcode)
21802180
else:
21812181
parser.print_help(file=sys.stderr)

0 commit comments

Comments
 (0)