mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 15:02:57 +00:00
Flush output in Python before running execvp (#2258)
This commit is contained in:
@@ -8,7 +8,8 @@ import sys
|
|||||||
# If we are in a JupyterHub, we pass on to `start-singleuser.py` instead so it does the right thing
|
# If we are in a JupyterHub, we pass on to `start-singleuser.py` instead so it does the right thing
|
||||||
if "JUPYTERHUB_API_TOKEN" in os.environ:
|
if "JUPYTERHUB_API_TOKEN" in os.environ:
|
||||||
print(
|
print(
|
||||||
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub."
|
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub.",
|
||||||
|
flush=True,
|
||||||
)
|
)
|
||||||
command = ["/usr/local/bin/start-singleuser.py"] + sys.argv[1:]
|
command = ["/usr/local/bin/start-singleuser.py"] + sys.argv[1:]
|
||||||
os.execvp(command[0], command)
|
os.execvp(command[0], command)
|
||||||
@@ -40,5 +41,5 @@ if "NOTEBOOK_ARGS" in os.environ:
|
|||||||
command += sys.argv[1:]
|
command += sys.argv[1:]
|
||||||
|
|
||||||
# Execute the command!
|
# Execute the command!
|
||||||
print("Executing: " + " ".join(command))
|
print("Executing: " + " ".join(command), flush=True)
|
||||||
os.execvp(command[0], command)
|
os.execvp(command[0], command)
|
||||||
|
@@ -20,5 +20,5 @@ if "NOTEBOOK_ARGS" in os.environ:
|
|||||||
command += sys.argv[1:]
|
command += sys.argv[1:]
|
||||||
|
|
||||||
# Execute the command!
|
# Execute the command!
|
||||||
print("Executing: " + " ".join(command))
|
print("Executing: " + " ".join(command), flush=True)
|
||||||
os.execvp(command[0], command)
|
os.execvp(command[0], command)
|
||||||
|
@@ -42,11 +42,7 @@ def test_start_notebook(
|
|||||||
f"Test that the start-notebook.py launches the {expected_command} server from the env {env} ..."
|
f"Test that the start-notebook.py launches the {expected_command} server from the env {env} ..."
|
||||||
)
|
)
|
||||||
host_port = find_free_port()
|
host_port = find_free_port()
|
||||||
container.run_detached(
|
container.run_detached(environment=env, ports={"8888/tcp": host_port})
|
||||||
tty=True,
|
|
||||||
environment=env,
|
|
||||||
ports={"8888/tcp": host_port},
|
|
||||||
)
|
|
||||||
# sleeping some time to let the server start
|
# sleeping some time to let the server start
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
logs = container.get_logs()
|
logs = container.get_logs()
|
||||||
|
Reference in New Issue
Block a user