Example on GitHub
Runnable example for capturing console output.
exec() and run() do not return stdout or stderr. Use the onStdio hook to capture output.
The per-execution onStdio option is available on exec() only. To capture output from run() calls, set a runtime-level hook when creating the NodeRuntime (see Default hook below).
Runnable example
Default hook
Set a runtime-level hook that applies to all executions:StdioHook type
Patterns
Collect to array:Why no buffering?
Buffering console output by default would let untrusted code grow host memory without bound by logging at high volume. The explicitonStdio hook puts you in control of how output is stored and when to stop collecting.