| 55 | // only what THIS command produced, so earlier output can't |
| 56 | // satisfy a later assertion and the scrollback stays natural. |
| 57 | const outputAfter = (text: string, line: string): string | null => { |
| 58 | const echoed = text.lastIndexOf(line); |
| 59 | if (echoed === -1) return null; |
| 60 | const after = text.slice(echoed + line.length); |
| 61 | return after.trimEnd().endsWith("\n$") ? after : null; |
| 62 | }; |
| 63 | const sh = async (line: string, timeoutMs: number) => { |
| 64 | await term.keyboard.type(line); |
| 65 | await term.keyboard.press("Enter"); |