diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 01:03:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 01:35:12 -0300 |
| commit | f453e3c3014ec578bbe6601a141134ce034185ff (patch) | |
| tree | 0ab3c2c9d80fb4416f7d33f8c096b9f1745e8d46 /test/selfmount.py | |
| parent | 28e90e064bd317d0e253edb2f5b305a6192f560b (diff) | |
| download | pardes-f453e3c3014ec578bbe6601a141134ce034185ff.tar.gz pardes-f453e3c3014ec578bbe6601a141134ce034185ff.zip | |
An event record is delivered in pieces to reads shorter than it, so a bash read loop on event works
A read shorter than the record waiting was refused EINVAL, and bash's
read, a byte at a time on a file it cannot seek in, failed on the
first record. A short read now takes the record's front and the next
read the rest, as log and pty/data already did and acme allows. A
unit test reads two records a byte at a time; selfmount runs a bash
read on event through the mount.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/selfmount.py')
| -rw-r--r-- | test/selfmount.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/selfmount.py b/test/selfmount.py index dd59083c..503ce1e0 100644 --- a/test/selfmount.py +++ b/test/selfmount.py @@ -186,6 +186,16 @@ def run(binary): followed = recipe.read_text() if recipe.exists() else '' recipe.unlink(missing_ok=True) check(ran == '0' and 'recipe-heard' in followed, f'the log follow recipe with cat hears a new record ({followed[-120:]!r})') + # A bash read loop on a pane's event: bash reads it a piece at a + # time, and each record still arrives whole, in pieces. + looped = Path(f'/tmp/{name}.events') + ran = run((f"bash -c 'exec 3<{mount}/pane/{first}/event; " + f"(sleep 1; echo Msg ev-loop > {mount}/pane/{first}/exec) & " + f"read -r line <&3; echo \"$line\" > {looped}'\n").encode()) + got_line = looped.read_text() if looped.exists() else '' + looped.unlink(missing_ok=True) + check(ran == '0' and got_line.startswith('FX') and got_line.rstrip().endswith('Msg ev-loop'), + f'a bash read loop on event reads a whole record ({got_line!r})') client.write('/exec', b'Msg still here\n') text = ''.join(cell[0] for cell in client.screen()['cells']) check('still here' in text, 'the editor answers after all of that') |
