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.

test(docker): pin child exit-code propagation; qualify the "replace" docstring

liwenjie20054393d0bf7bbc03
diff --git a/docker/entrypoint.py b/docker/entrypoint.py
index 4b8407f2..4a5d2bf0 100644
--- a/docker/entrypoint.py
+++ b/docker/entrypoint.py
@@ -1,4 +1,5 @@
-"""Load supported file-backed secrets, then replace this process with the command."""
+"""Load supported file-backed secrets, then replace this process with the command; on Windows,
+run the child and propagate its exit code instead."""
import os
from pathlib import Path
import subprocess
diff --git a/tests/test_docker_entrypoint.py b/tests/test_docker_entrypoint.py
index 379b6231..04c32fd5 100644
--- a/tests/test_docker_entrypoint.py
+++ b/tests/test_docker_entrypoint.py
@@ -154,6 +154,21 @@ class EntrypointTests(unittest.TestCase):
self.assertNotEqual(result.returncode, 0)
self.assertIn("command is required", result.stderr)
+ def test_child_exit_code_propagates(self):
+ """A child that exits 42 hands that status to the entrypoint's caller.
+
+ The exec path keeps it by replacing the process; the Windows path runs the child and
+ propagates `returncode`, which the `os.execvp` emulation never did -- it exited 0
+ whatever the child did.
+ """
+ blocked = {prefix for secret in SECRET_NAMES for prefix in (secret, secret + "_FILE")}
+ env = {key: value for key, value in os.environ.items() if key not in blocked}
+ result = subprocess.run(
+ [sys.executable, str(ENTRYPOINT), sys.executable, "-c", "import sys; sys.exit(42)"],
+ env=env, capture_output=True, text=True, check=False,
+ )
+ self.assertEqual(result.returncode, 42, result.stderr)
+
if __name__ == "__main__":
unittest.main()