Terminal

A handle to a terminal emulator running inside a Pod

A Terminal is a handle to a terminal emulator running inside a Pod. It is created by createDefaultTerminal or createCustomTerminal, and passed to run to connect a process to I/O.

class Terminal {
write(data: string | Uint8Array): void;
}

Creating a Terminal

Usage

const terminal = await pod.createDefaultTerminal(element);
await pod.run("node", ["script.js"], { terminal });

Writing to a terminal

write sends text or bytes directly to the terminal’s output, without going through a process in the Pod. Running processes do not receive it as input. Use it to show your own messages alongside program output, such as the command about to run:

terminal.write("$ npm install\r\n");
await pod.run("npm", ["install"], { terminal });