diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 22:58:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 22:58:12 -0300 |
| commit | 3ddd34bcd94ba95d9cacbf6afcb9f89a16a414ce (patch) | |
| tree | e4fee3fc0c7e228f4ac0a5877eb44b997f7bdb11 /test/fs.py | |
| parent | 1b654dfeb5b832d110beef0ec7dd8a3b7f66e431 (diff) | |
| download | pardes-3ddd34bcd94ba95d9cacbf6afcb9f89a16a414ce.tar.gz pardes-3ddd34bcd94ba95d9cacbf6afcb9f89a16a414ce.zip | |
Edit's w to a file changed on disk since read is refused once, as Save is (w again to overwrite), the rest of an X/'/w written and the refused named; Edit filters get a pane command's environment ($PARDES_MOUNT, $PARDES_9P, $PARDES_PID, $winid); an Edit with no commands runs beside one whose commands run unless it touches a file that one changes, refused busy (EBUSY) as is a second Edit with commands
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/fs.py')
| -rw-r--r-- | test/fs.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -1123,6 +1123,27 @@ def edit_commands(binary): assert (root / 'b.txt').read_bytes() == b'APPLE pie\n' client.write(f'/pane/{a}/ctl', b'Edit 1 w first.txt\n') assert (root / 'first.txt').read_bytes() == b'APPLE\n' + # A file changed on disk under unsaved edits: Edit's w refuses + # once, as Save does, and the next w overwrites it. + w1 = root / 'w1.txt' + w1.write_bytes(b'one\n') + w = look(client, str(w1)) + client.write(f'/pane/{w}/ctl', b'Edit $a/two/\n') + seen = client.read('/log').decode().count(f'\nchanged {w}') + with open(w1, 'ab') as f: + f.write(b'external\n') + deadline = time.monotonic() + 10 + while client.read('/log').decode().count(f'\nchanged {w}') == seen: + assert time.monotonic() < deadline, 'the change on disk was not heard' + time.sleep(.05) + try: + client.write(f'/pane/{w}/ctl', b'Edit w\n') + raise AssertionError('w overwrote a file changed on disk') + except OSError as why: + assert 'modified on disk since read (w again to overwrite)' in str(why), why + assert w1.read_bytes() == b'one\nexternal\n' + client.write(f'/pane/{w}/ctl', b'Edit w\n') + assert w1.read_bytes() == b'one\ntwo', w1.read_bytes() def test(binary, quic=False): |
