diff options
Diffstat (limited to 'test/fs.py')
| -rw-r--r-- | test/fs.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -17,7 +17,7 @@ from ninep import Client @contextlib.contextmanager def session(binary, root, name, *options, socket_name=None, file=None, tty=False, network=None, - launch=None, inherited=None): + launch=None, inherited=None, terminal=None): env = {key: value for key, value in os.environ.items() if not key.startswith('PARDES_')} env.update(HOME=str(root), XDG_RUNTIME_DIR=str(root), @@ -47,6 +47,9 @@ def session(binary, root, name, *options, socket_name=None, file=None, tty=False stdout=slave if tty else subprocess.DEVNULL, stderr=subprocess.PIPE, start_new_session=True, preexec_fn=preexec) + if terminal is not None: + # Borrowed handles for input-driving probes, valid inside this context. + terminal.update(pid=child.pid, input_fd=master) if launch is not None and socket_name is None: address = root / f'pardes-9p-{child.pid}.sock' if slave is not None: @@ -77,6 +80,8 @@ def session(binary, root, name, *options, socket_name=None, file=None, tty=False assert set(network) == {'TCP', 'QUIC'}, network yield client, address finally: + if terminal is not None: + terminal.clear() if child is not None: if child.poll() is None: child.terminate() |
