Program.stream
Everything the program writes, as UTF-8 text in the order it was written, until it exits and its last write has arrived.
Source and package
- Qualified name
-
Program.stream - Module
- program
- Declared in
- Program
- Package
- libtmux
- Source
- packages/libtmux/src/program.ts
-
Description#
Needs
stream: trueat spawn. The text is the terminal's: line ends are\r\n, escape sequences are left in, and bytes that are not UTF-8 become U+FFFD. Each call reads from the start; leaving the loop early stops it, and so doessignal, withTmuxTransportErrorof kindcancelled. Either way the program runs on.Examples#
await using program = await server.spawn(["seq", "1", "3"], { stream: true });let text = "";for await (const chunk of program.stream()) text += chunk;text; // "1\r\n2\r\n3\r\n"- Parameters