Skip to content

Commit 2dc889c

Browse files
committed
remote/client: suppress gRPC error message on shutdown
This is a workround for the gRPC issue grpc/grpc#38679. Since Python 3.12, an empty exception message is printed from gRPC during shutdown, although nothing seems to go wrong. As this is confusing for users, suppress the message by closing stderr. When in debug mode, we keep it open. Signed-off-by: Jan Luebbe <[email protected]>
1 parent 9636068 commit 2dc889c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

labgrid/remote/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,13 @@ def main():
21692169
except Exception: # pylint: disable=broad-except
21702170
traceback.print_exc(file=sys.stderr)
21712171
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())
21722179
exit(exitcode)
21732180
else:
21742181
parser.print_help(file=sys.stderr)

0 commit comments

Comments
 (0)