blob: 27e1ba3d306e28bcf0d3a80c1880bc62186b6c33 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# `--nested` is the documented escape hatch out of the hand-the-file-outward
# mechanism, and nested.snap covers only the mechanism. The flag says two
# things at once and both are asserted here: an instance carrying it keeps its
# own argument instead of forwarding it, AND it is not an outer instance for
# anything launched inside IT (tty.zig binds no socket when opts.nested).
#
# The same trick nested.snap uses to get a genuine descendant: a pane shell's
# parent IS the app under test, so `$(readlink /proc/$PPID/exe)` in a pane is
# this exact binary. What discriminates is the GRID — a second topbar drawn
# INSIDE the pane, with the outer instance still one shell wide.
#
# Long waits on purpose: each arm forks and execs whole further pardes.
file nested.txt optout-marker\nsecond-optout-line\n
dirmk innerdir
file innerdir/deeper.txt deepest-marker\n
# --- a file argument, WITH the flag: the inner keeps it ---
# Without --nested this is nested.snap's first arm and the outer grows a
# file pane beside the shell. Here the outer's layout never changes: one
# shell, and a whole second pardes drawn inside it holding nested.txt.
start 30 100
wait 8000 $
stable 700 20000
text $(readlink /proc/$PPID/exe) --nested nested.txt
key enter
wait 20000 optout-marker
stable 700 20000
snap optout-file
# --- ...and it is not an outer instance either ---
# The subshell is what makes the wait unambiguous: the inner boots in
# `innerdir` while the outer pane's own shell stays in cwd, so `cwd/innerdir`
# on the grid can only be the inner instance's tagline. --nested with no
# argument is still a bare launch, so the inner comes up in tty mode and
# keystrokes travel through both layers to its shell.
start 30 100
wait 8000 $
stable 700 20000
text (cd innerdir && $(readlink /proc/$PPID/exe) --nested)
key enter
wait 20000 cwd/innerdir
stable 700 20000
snap inner-shell
# A third pardes, launched from inside the inner one. Its nearest pardes
# ancestor is the INNER instance, which bound no socket, so the send fails and
# it opens its own session where it stands — three topbars. The assertion is
# the row it did NOT appear on: the outer instance is still one shell pane, and
# a walk that had skipped past the opted-out instance would have put
# deeper.txt up there beside it.
text $(readlink /proc/$PPID/exe) deeper.txt
key enter
wait 20000 deepest-marker
stable 700 20000
snap inner-launch
|