Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

fix(docker): run the child command instead of exec'ing it on Windows

liwenjie2005434078a11ff503
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d4f38072..4a6fa0ef 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -291,14 +291,6 @@ jobs:
# Same suites as the Linux job. Guarded with -f so a suite added by another open branch
# cannot make this job red on a tree that does not have it yet.
- #
- # test_docker_entrypoint is skipped here on purpose. It drives docker/entrypoint.py, which
- # only ever runs inside a Linux container, through `os.execvp`. On Windows exec* rebuilds
- # the command line from argv without re-applying the quoting `subprocess` used to build it,
- # so its `-c "<script>"` argument arrives split at the first space and the child dies with
- # "SyntaxError: invalid syntax" before printing. The environment passthrough the suite
- # exists to check is unaffected, and switching the entrypoint to `subprocess.run` makes it
- # pass -- a change to a container script, so it belongs in its own PR, not this one.
- name: Routing and language-detection tests
run: |
for t in test_router test_criteria test_batch test_predict_long \
@@ -314,10 +306,6 @@ jobs:
test_langchain test_portability test_training \
test_example_server_limits test_blank_lang_routing \
test_export_onnx_safety test_load_errors test_revision_pinning; do
- if [ "$t" = "test_docker_entrypoint" ]; then
- echo "skipping $t: docker/entrypoint.py is Linux-container only"
- continue
- fi
if [ -f "tests/$t.py" ]; then python "tests/$t.py"; fi
done
shell: bash
diff --git a/docker/entrypoint.py b/docker/entrypoint.py
index b2cc8a82..4b8407f2 100644
--- a/docker/entrypoint.py
+++ b/docker/entrypoint.py
@@ -1,6 +1,7 @@
"""Load supported file-backed secrets, then replace this process with the command."""
import os
from pathlib import Path
+import subprocess
import sys
# Both names are read as `<NAME>_FILE` and then moved into `<NAME>`, so a secret can be
@@ -23,6 +24,13 @@ def main():
os.environ.pop(name + "_FILE", None)
if len(sys.argv) < 2:
sys.exit("A container command is required")
+ if os.name == "nt":
+ # os.execvp is an emulation here: it never replaces the process, and the C runtime
+ # rebuilds the command line by joining argv with spaces, so a quoted argument (a path
+ # with a space, a `-c "<script>"`) arrives split and the child dies before it runs.
+ # Run the child and propagate its exit code instead. The container itself is Linux,
+ # where the exec below keeps the replacement the docstring promises.
+ sys.exit(subprocess.run(sys.argv[1:]).returncode)
os.execvp(sys.argv[1], sys.argv[1:])