(text: string, line: string)
| 58 | await term.screen.waitForText("$", { timeoutMs: 10_000 }); |
| 59 | |
| 60 | const outputAfter = (text: string, line: string): string | null => { |
| 61 | const echoed = text.lastIndexOf(line); |
| 62 | if (echoed === -1) return null; |
| 63 | const after = text.slice(echoed + line.length); |
| 64 | return after.trimEnd().endsWith("\n$") ? after : null; |
| 65 | }; |
| 66 | const sh = async (line: string, timeoutMs: number) => { |
| 67 | await term.keyboard.type(line); |
| 68 | await term.keyboard.press("Enter"); |