8000 WebAgg: flush stdout after printing, redirect "stopped" message to st… · matplotlib/matplotlib@5a7bb98 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a7bb98

Browse files
committed
WebAgg: flush stdout after printing, redirect "stopped" message to stderr
Without flushing, the message can be displayed too late. KeyboardInterrupt message should be printed to stderr.
1 parent 28d3fcd commit 5a7bb98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_webagg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import json
2222
import os
2323
import random
24+
import sys
2425
import socket
2526
import threading
2627

@@ -333,11 +334,12 @@ def start(cls):
333334
launched. We may end up with two concurrently running loops in that
334335
unlucky case with all the expected consequences.
335336
"""
336-
print("Press Ctrl+C to stop server")
337+
print("Press Ctrl+C to stop WebAgg server")
338+
sys.stdout.flush()
337339
try:
338340
tornado.ioloop.IOLoop.instance().start()
339341
except KeyboardInterrupt:
340-
print("Server stopped")
342+
six.print_("Server is stopped", file=sys.stderr)
341343
finally:
342344
cls.started = False
343345

0 commit comments

Comments
 (0)
0