1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Harden detached worker module startup

This commit is contained in:
Andraxion 2026-07-29 12:48:52 -04:00
parent 5b43c44dd7
commit d65b83a140
3 changed files with 12 additions and 3 deletions

View file

@ -0,0 +1,8 @@
"""Private module entry point for the detached projection worker."""
from __future__ import annotations
from .projection_worker import main
if __name__ == "__main__":
raise SystemExit(main())

View file

@ -201,7 +201,7 @@ def _invoke_worker(request: bytes) -> subprocess.CompletedProcess[bytes]:
"PYTHONUTF8": "1",
}
)
command = [sys.executable, "-I", "-m", "docforge.projection_worker"]
command = [sys.executable, "-I", "-m", "docforge._projection_worker_main"]
with tempfile.TemporaryFile() as output:
completed = subprocess.run(
command,

View file

@ -118,7 +118,7 @@ class ProjectionWorkerTests(unittest.TestCase):
command = launched.call_args.args[0]
options = launched.call_args.kwargs
self.assertEqual(
[sys.executable, "-I", "-m", "docforge.projection_worker"],
[sys.executable, "-I", "-m", "docforge._projection_worker_main"],
command,
)
self.assertIs(options["shell"], False)
@ -372,7 +372,7 @@ class ProjectionWorkerTests(unittest.TestCase):
for request in requests:
with self.subTest(length=len(request)):
completed = subprocess.run(
[sys.executable, "-m", "docforge.projection_worker"],
[sys.executable, "-I", "-m", "docforge._projection_worker_main"],
cwd=ROOT,
input=request,
capture_output=True,
@ -381,6 +381,7 @@ class ProjectionWorkerTests(unittest.TestCase):
)
self.assertEqual(2, completed.returncode)
self.assertEqual(b"", completed.stdout)
self.assertEqual(b"", completed.stderr)
if __name__ == "__main__":