Expand description
Script execution engine
See src/scripting/CLAUDE.md for the execution model, the input/output
contract, and — importantly — the trust boundary: scripts are not
sandboxed and run with the full privileges of the netget process.
§Async vs sync
execute_script_async is the entry point that should be used from every
async context (all protocol servers, event handlers, MCP). It is built on
tokio::process so no OS thread is parked while a script runs, and it
writes stdin concurrently with draining stdout/stderr so a script that
produces output before consuming its input cannot deadlock.
execute_script is a blocking convenience wrapper retained for
synchronous callers (tests, tooling). It runs the async path on a dedicated
thread with its own current-thread runtime, so it never nests runtimes, but
it does block the calling thread and must not be used from async code.
Constants§
- DEFAULT_
SCRIPT_ TIMEOUT - Default wall-clock budget for a single script invocation.
- SCRIPT_
TIMEOUT_ SECS - Default timeout for script execution (30 seconds)
Functions§
- execute_
script - Execute a script with the given input (blocking).
- execute_
script_ async - Execute a script with the given input (async, non-blocking).
- execute_
script_ blocking_ with_ timeout - Blocking variant of
execute_script_with_timeout_async. - execute_
script_ with_ timeout_ async - Execute a script with an explicit timeout (async, non-blocking).