A supervised long-running OS process.
Wraps NetRunner.Process for integration into a supervision tree.
Automatically drains stdout/stderr to prevent pipe blocking. Both streams
are delivered to the :on_output callback; stderr is owned by the Daemon's
own drain task (the underlying process runs with stderr: :disabled), so
:on_output sees the complete stderr stream in order.
Usage
# In your supervision tree:
children = [
{NetRunner.Daemon, cmd: "redis-server", args: ["--port", "6380"], name: MyApp.Redis}
]
# Or start manually:
{:ok, pid} = NetRunner.Daemon.start_link(cmd: "tail", args: ["-f", "/var/log/syslog"],
on_output: :log)
# Interact:
NetRunner.Daemon.os_pid(pid)
NetRunner.Daemon.alive?(pid)
NetRunner.Daemon.write(pid, "input\n")
Summary
Functions
Returns a specification to start this module under a supervisor.