Skip to main content

Module executor

Module executor 

Source
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).