Skip to content

feat: add hermes-node restart command - #124

Merged
blaspat merged 1 commit into
mainfrom
feat/restart-command
Aug 28, 2026
Merged

feat: add hermes-node restart command#124
blaspat merged 1 commit into
mainfrom
feat/restart-command

Conversation

@blaspat

@blaspat blaspat commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds hermes-node restart [--config <path>] — a one-command way to bounce the daemon (previously: hermes-node stop + hermes-node run).

  • Stops the running daemon (SIGTERM → SIGKILL escalation, same path as hermes-node stop) then starts a fresh one
  • No daemon running → simply starts
  • Failed stop aborts the restart — never starts while another daemon might still hold the lock
  • Shares the single-instance guard: the start goes through the same detach path as hermes-node run

Test Plan

  • Restart stops a live daemon (real sacrificial PID, SIGTERM'd) then issues a fresh start
  • Not-running case skips the stop phase and starts
  • Stop-failure aborts without starting (live lock + no status file)
  • Full suite go test ./... passes; go vet + gofmt clean

Notes

  • The start hook is a package variable (startDaemon, default runDetach) so tests can stub the fork — a Go test binary can't act as the daemon child (same override seam as osExecutable/osUserHomeDir)

Restarting a daemon currently requires two manual invocations
(`hermes-node stop` then `hermes-node run`), and a run issued too
quickly after a stop can race the old process for the lock.

Add `hermes-node restart [--config <path>]`:

- Stops the running daemon (SIGTERM -> SIGKILL escalation, same
  path as `hermes-node stop`) and then starts a fresh one
- With no daemon running it simply starts
- A failed stop aborts the restart, so it never starts while
  another daemon might still hold the lock
- Shares the single-instance guard: the start goes through the
  same detach path as `hermes-node run`

The start hook is a package variable (startDaemon, defaulting to
runDetach) so tests can stub the fork — a Go test binary can't act
as the daemon child. Tests: restart stops a real sacrificial PID
then starts; not-running case skips the stop; stop-failure aborts
without starting.

Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
@blaspat
blaspat merged commit 8b9c833 into main Aug 28, 2026
14 checks passed
@blaspat
blaspat deleted the feat/restart-command branch August 28, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant