From 9e7f017bad59d03fd79d3c0e72b4fc46386066e6 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 10 Jan 2026 12:44:35 +0100 Subject: [PATCH 1/3] Add pid parameter to on_startup callback Exposes the daemon's process ID to the on_startup callback, allowing users to log or register the PID when the daemon starts. Co-Authored-By: Claude Opus 4.5 --- src/lib.rs | 4 ++-- src/server.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 71afc56..4098519 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -421,10 +421,10 @@ where /// Called once when the daemon starts, before accepting connections. /// - /// Override this method to log the startup reason or perform + /// Override this method to log the startup reason and PID, or perform /// initialization that depends on whether this is a fresh start /// or a restart. /// /// The default implementation does nothing. - fn on_startup(&self, _reason: StartupReason) {} + fn on_startup(&self, _reason: StartupReason, _pid: u32) {} } diff --git a/src/server.rs b/src/server.rs index c0c81b7..4f77742 100644 --- a/src/server.rs +++ b/src/server.rs @@ -228,8 +228,8 @@ where "Daemon started and listening" ); - // Notify handler of startup reason - self.handler.on_startup(self.startup_reason); + // Notify handler of startup reason and PID + self.handler.on_startup(self.startup_reason, pid); loop { // Select between accepting connection and shutdown signal From 7dceadb4f8e1d276b1ad65dc977b77c952aeda2f Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 10 Jan 2026 12:45:02 +0100 Subject: [PATCH 2/3] Bump version to 0.10.0 Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 6 ++++++ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a20b4..22484b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.0] - 2025-01-10 + +### Changed (BREAKING) + +- `CommandHandler::on_startup()` now receives `pid: u32` as second parameter + ## [0.9.0] - 2025-12-29 ### Changed (BREAKING) diff --git a/Cargo.toml b/Cargo.toml index edc5d07..f043077 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "daemon-cli" -version = "0.9.0" +version = "0.10.0" edition = "2024" [dependencies] From bac9f532217fee2120fba55ac9fb6606e92831ab Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 10 Jan 2026 12:51:43 +0100 Subject: [PATCH 3/3] Fix changelog year to 2026 Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22484b6..c691d69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.10.0] - 2025-01-10 +## [0.10.0] - 2026-01-10 ### Changed (BREAKING)