diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 10:58:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 6add2ee79879712b39f6f76165a24a641127dd3b (patch) | |
| tree | fe8ea592e8f6e6642a81cbfbe70b3b2527b5f3f0 /test | |
| parent | 2a71bff5f06ba3e785a5eb96a8377e2cab8e2cdd (diff) | |
| download | pardes-6add2ee79879712b39f6f76165a24a641127dd3b.tar.gz pardes-6add2ee79879712b39f6f76165a24a641127dd3b.zip | |
Kill written to /ctl is answered before the editor quits
The write got EPIPE: Kill set quit, the request waited for the editor to
settle its effects, and the editor quit and cut the connections first.
A write that quits the editor is now answered at once, and the listener
lets pending answers out (up to 200 ms) before it stops the runner.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/fs.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -405,9 +405,29 @@ def run_file(binary): assert closing == [b'error shell gone\n'], closing +def kill_answers(binary): + """Kill written to /ctl is answered before the editor quits.""" + with tempfile.TemporaryDirectory(prefix='pardes-kill-') as directory: + seen = {} + with session(binary, Path(directory), 'kill', terminal=seen) as (client, _): + client.write('/ctl', b'Kill\n') + deadline = time.monotonic() + 5 + while time.monotonic() < deadline: + try: + # a zombie has quit; the session reaps it + if Path(f'/proc/{seen["pid"]}/stat').read_text().split(') ')[1][0] == 'Z': + break + except FileNotFoundError: + break + time.sleep(.01) + else: + raise AssertionError('Kill did not quit the editor') + + def test(binary, quic=False): started = time.monotonic() run_file(binary) + kill_answers(binary) for options, message in [ (['--fs'], b'no such option'), (['--fs9'], b'no such option'), |
