Processes
Reference for spawn options and the StartpodProcess interface.
spawn(command, args, options)
const process = await startpod.spawn("node", ["index.js"], {
cwd: startpod.workdir,
env: { MODE: "preview" },
terminal: { cols: 100, rows: 30 },
})commandstringrequiredCommand name, such as node, npm, npx, jsh, bash, or a supported
local package binary.
argsstring[]Command arguments. Defaults to an empty array.
options.cwdstringWorking directory. Defaults to startpod.workdir.
options.envRecord<string, string | number | boolean>Environment values merged over the runtime defaults.
options.terminal{ cols: number; rows: number }Initial dimensions for an interactive process.
StartpodProcess
interface StartpodProcess {
readonly output: ReadableStream<string>
readonly outputRecords?: ReadableStream<StartpodOutputRecord>
readonly input: WritableStream<string>
readonly exit: Promise<number>
resize?(dimensions: { cols: number; rows: number }): void
kill(): void
}The main output stream combines stdout and stderr. outputRecords, when provided, labels runtime-status output and application stdout or stderr without changing the chunk text.