Skip to content

Code Execution

ZetoPad can execute code snippets in multiple languages, showing output directly in the app.

Running Code

  1. Open a code snippet
  2. Press Cmd+R to run
  3. Output appears in the Output Panel at the bottom

Supported Languages

Native Execution

These languages use your system’s installed interpreters:

LanguageInterpreter
Pythonpython3 or python
JavaScriptnode
TypeScriptts-node or tsx
Rubyruby
Gogo run
Rustrustc + run
Shellbash or sh
PHPphp
Perlperl
RRscript

WASM Sandboxed Execution

For safe execution without system access, ZetoPad includes WebAssembly-based runtimes:

LanguageRuntime
JavaScriptQuickJS
LuaLua WASM
PythonPyodide

WASM execution is:

  • Sandboxed - No file system or network access
  • Fast startup - No external interpreter needed
  • Consistent - Same behavior on any system

Output Panel

The Output Panel shows:

  • stdout - Standard output from your code
  • stderr - Error messages and warnings
  • Exit code - Success (0) or failure

Panel Controls

  • Clear - Remove output
  • Copy - Copy output to clipboard
  • Close - Hide the panel

Timeout Handling

Code execution has a configurable timeout to prevent runaway scripts:

  • Default: 30 seconds
  • Configurable in Settings
  • Execution is terminated if exceeded

Size Limits

Output is limited to prevent memory issues:

  • Maximum output size: 1MB
  • Truncated with “[Output truncated]” message

Security Considerations

For untrusted code, use the WASM sandbox mode which has no system access.

Tips

Quick Testing

Create a “scratch” snippet for quick code experiments:

scratch.py
x = [1, 2, 3, 4, 5]
print(sum(x))
print([i**2 for i in x])

Environment Variables

Native execution inherits your shell’s environment variables.

Working Directory

Code runs from a temporary directory. Use absolute paths for file operations.