ComputeTerminal

output()

terminal.output({ since? }) → Promise<OutputState>

Read terminal output from a cursor and refresh its state.

Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

let cursor = 0;
const result = await terminal.output({ since: cursor });
process.stdout.write(result.text);
cursor = result.cursor;
import sys

cursor = 0
result = terminal.output(since=cursor)
sys.stdout.write(result["text"])
cursor = result["cursor"]
sincenumber

Output cursor to continue from. Defaults to 0 for all retained output.

The response carries new text, the next cursor, terminal status, exit code and busy state. The instance's status, busy, exitCode and cwd are updated when returned by the API.