Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchestrator: do not redirect stdin of children #69

Merged
merged 7 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/dictionaries/pavel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test(session):
# 1. It requires access to the code generated by the test suite.
# 2. It has to be run separately per Python version we support.
# If the interpreter is not CPython, this may need to be conditionally disabled.
session.install("mypy == 0.942")
session.install("mypy == 0.991")
session.run("mypy", "--strict", *map(str, src_dirs))


Expand Down
26 changes: 21 additions & 5 deletions tests/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,31 @@ def __del__(self) -> None:
self._inferior.kill()


_ENV_COPY_KEYS = {
"PATH",
"SYSTEMROOT",
"HOMEDRIVE",
"HOMEPATH",
"USERPROFILE",
"WINDIR",
"TEMP",
"TMP",
"LOCALAPPDATA",
"APPDATA",
"PROGRAMFILES",
"PROGRAMFILES(X86)",
"PROGRAMW6432",
"PROGRAMDATA",
"ALLUSERSPROFILE",
"PUBLIC",
}


def _get_env(environment_variables: typing.Optional[typing.Dict[str, str]] = None) -> typing.Dict[str, str]:
from tests import DEPS_DIR

venv_path = Path(sys.executable).parent
copy_keys = {
"PATH",
"SYSTEMROOT",
}
env = {k: v for k, v in os.environ.items() if k in copy_keys}
env = {k: v for k, v in os.environ.items() if k in _ENV_COPY_KEYS}
# Buffering must be DISABLED, otherwise we can't read data on Windows after the process is interrupted.
# For some reason stdout is not flushed at exit there.
env.update(
Expand Down
2 changes: 1 addition & 1 deletion yakut/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.1
0.12.0
3 changes: 1 addition & 2 deletions yakut/cmd/orchestrate/_child.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import time
import signal
from subprocess import Popen, DEVNULL
from subprocess import Popen
from typing import Dict, Optional, Callable, List, Tuple, BinaryIO, Any
import yakut

Expand Down Expand Up @@ -62,7 +62,6 @@ def __init__(self, cmd: str, env: Dict[str, bytes], *, stdout: BinaryIO, stderr:
shell=True,
stdout=stdout,
stderr=stderr,
stdin=DEVNULL,
bufsize=1,
)

Expand Down
2 changes: 1 addition & 1 deletion yakut/cmd/subscribe/_sync_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def run() -> None:
syn = make_sync_async([sub_a, sub_b])
results: list[tuple[tuple[tuple[Any, TransferFrom] | None, Subscriber[Any]], ...]] = []
# noinspection PyTypeChecker
tsk = asyncio.create_task(syn(results.append))
tsk = asyncio.create_task(syn(results.append)) # type: ignore
try:
await asyncio.sleep(0.1)
assert not results
Expand Down