summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fs.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/fs.py b/test/fs.py
index 3c10c53b..20a9bbff 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -515,6 +515,28 @@ def new_terminals_named_once(binary):
for serial in made:
assert f'\nrename {serial} ' not in '\n' + log, (serial, log)
assert f'\nnew {serial} {root}' in '\n' + log, (serial, log)
+ # A shell that cannot start (its interpreter is not there): Tty
+ # fails the write with why and leaves no pane; pty/ctl exec
+ # fails with why and keeps its terminal.
+ bad = root / 'badsh'
+ bad.write_bytes(b'#!/nonexistent/interp\n')
+ bad.chmod(0o755)
+ panes = client.read('/index')
+ try:
+ client.write('/pane/1/ctl', f'Tty {bad}\n'.encode())
+ raise AssertionError('Tty of a shell that cannot start was taken')
+ except OSError as refused:
+ assert 'shell' in str(refused), refused
+ time.sleep(.3)
+ assert client.read('/index').count(b'\n') == panes.count(b'\n'), client.read('/index')
+ client.write('/ctl', f'Shell {bad}\n'.encode())
+ try:
+ client.write(f'/pane/{made[0]}/pty/ctl', b'exec\n')
+ raise AssertionError('pty/ctl exec of a shell that cannot start was taken')
+ except OSError as refused:
+ assert 'shell' in str(refused), refused
+ client.write('/ctl', b'Shell\n')
+ assert str(made[0]).encode() in b' '.join(r.split()[0] for r in client.read('/index').splitlines())
def workflow_canary(binary):