Documentation
¶
Index ¶
- func Interceptor(src io.Reader, dst io.Writer, out chan<- []byte) error
- func PipelineIn(src io.Reader, dst io.Writer, errWriter io.Writer, ...) error
- func PipelineOut(src io.Reader, dst io.Writer, chain *middleware.SwappableChain, ...) error
- func Run(ctx context.Context, args []string, logger *slog.Logger) error
- func RunWithMiddleware(ctx context.Context, args []string, logger *slog.Logger, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Interceptor ¶
Interceptor copies bytes from src to dst while also sending each chunk to the out channel for observation. The channel receives raw byte slices as they are read; each slice is a fresh copy safe for concurrent use.
Interceptor runs until src returns io.EOF or any other read error. It closes the out channel when it finishes.
func PipelineIn ¶
func PipelineIn(src io.Reader, dst io.Writer, errWriter io.Writer, chain *middleware.SwappableChain, logger *slog.Logger, out chan<- []byte) error
PipelineIn processes the parent→child direction (stdin). Parsed JSON-RPC requests are passed through the middleware chain. If a request is blocked, a JSON-RPC error response is written to errWriter (the upstream stdout) instead of forwarding to the child. Non-JSON or non-request messages are forwarded verbatim.
func PipelineOut ¶
func PipelineOut(src io.Reader, dst io.Writer, chain *middleware.SwappableChain, logger *slog.Logger, out chan<- []byte) error
PipelineOut processes the child→parent direction (stdout). Parsed JSON-RPC responses are passed through the middleware chain. Non-JSON or non-response messages are forwarded verbatim.
func Run ¶
Run launches the program described by args (args[0] is the executable, args[1:] are its arguments), wires up stdin/stdout interceptors, and forwards signals. It blocks until the child process exits and returns any error. The exit code of the child is propagated via *exec.ExitError.
func RunWithMiddleware ¶
func RunWithMiddleware(ctx context.Context, args []string, logger *slog.Logger, chain *middleware.SwappableChain, metrics *monitor.Metrics, monSrv *monitor.Server) error
RunWithMiddleware launches the child process described by args and wires up PipelineIn/PipelineOut interceptors that run the provided middleware chain. If chain is nil it falls back to the plain Interceptor. monSrv and metrics may be nil.
Types ¶
This section is empty.