Skip to main content

Module daemon

Module daemon 

Source
Expand description

Persistent bash coprocess daemon for reef persist full.

Architecture:

  • start() spawns a detached daemon process (reef daemon _serve).
  • exec() connects to the socket, sends a command, and receives the output + env diff + exit code.
  • stop() sends a shutdown signal via the socket.
  • status() checks if the daemon is alive by pinging the socket.

The daemon runs single-threaded — one command at a time, matching interactive shell semantics. Zero external dependencies.

Functions§

exec
Send a command to the daemon and print results. Returns the command’s exit code.
serve
Main daemon loop: spawn bash, accept connections, proxy commands. Called by reef daemon _serve (internal, not user-facing).
start
Start the daemon: spawn a detached reef daemon _serve process.
status
Check if the daemon is running and responsive.
stop
Tell the daemon to shut down.