Skip to main content

run_stdio_loop

Function run_stdio_loop 

Source
pub async fn run_stdio_loop(router: Router) -> Result<()>
Expand description

Read JSON-RPC 2.0 requests line-by-line from stdin, dispatch each through router, and write the response to stdout — interleaved with any server-initiated notifications pushed via this connection’s ConnectionContext. Returns on stdin EOF or on receipt of SIGTERM/ SIGINT.

Why: the single entry point crate::serve::run_stdio calls once the router is assembled. What: thin wrapper over [run_loop] binding the real process stdio, a fresh long-lived ConnectionContext, and the shared trusty_common::shutdown_signal(). Test: exercised end-to-end (minus real signals/stdio) by run_loop’s tests below.