Skip to content

Commit 929ebdb

Browse files
authored
Flush output in Python before running execvp (#2258)
1 parent 95aa99d commit 929ebdb

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

images/base-notebook/start-notebook.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
# If we are in a JupyterHub, we pass on to `start-singleuser.py` instead so it does the right thing
99
if "JUPYTERHUB_API_TOKEN" in os.environ:
1010
print(
11-
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub."
11+
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub.",
12+
flush=True,
1213
)
1314
command = ["/usr/local/bin/start-singleuser.py"] + sys.argv[1:]
1415
os.execvp(command[0], command)
@@ -40,5 +41,5 @@
4041
command += sys.argv[1:]
4142

4243
# Execute the command!
43-
print("Executing: " + " ".join(command))
44+
print("Executing: " + " ".join(command), flush=True)
4445
os.execvp(command[0], command)

images/base-notebook/start-singleuser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
command += sys.argv[1:]
2121

2222
# Execute the command!
23-
print("Executing: " + " ".join(command))
23+
print("Executing: " + " ".join(command), flush=True)
2424
os.execvp(command[0], command)

tests/by_image/base-notebook/test_start_container.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ def test_start_notebook(
4242
f"Test that the start-notebook.py launches the {expected_command} server from the env {env} ..."
4343
)
4444
host_port = find_free_port()
45-
container.run_detached(
46-
tty=True,
47-
environment=env,
48-
ports={"8888/tcp": host_port},
49-
)
45+
container.run_detached(environment=env, ports={"8888/tcp": host_port})
5046
# sleeping some time to let the server start
5147
time.sleep(2)
5248
logs = container.get_logs()

0 commit comments

Comments
 (0)