diff options
Diffstat (limited to 'makima/src/daemon')
| -rw-r--r-- | makima/src/daemon/task/manager.rs | 9 | ||||
| -rw-r--r-- | makima/src/daemon/ws/protocol.rs | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs index 5eed0e8..a3e4732 100644 --- a/makima/src/daemon/task/manager.rs +++ b/makima/src/daemon/task/manager.rs @@ -1663,6 +1663,15 @@ impl TaskManager { tracing::info!(source_dir = ?source_dir, "Inheriting git config"); self.handle_inherit_git_config(source_dir).await?; } + DaemonCommand::RestartDaemon => { + tracing::info!("Received restart command from server, initiating daemon restart..."); + // Shutdown all running tasks gracefully + self.shutdown_all_processes(std::time::Duration::from_secs(5)).await; + // Exit the process - the daemon should be restarted by a process manager + // or the user can restart it manually + tracing::info!("Daemon restart: exiting process with code 42 (restart requested)"); + std::process::exit(42); + } } Ok(()) } diff --git a/makima/src/daemon/ws/protocol.rs b/makima/src/daemon/ws/protocol.rs index d0bcc19..3b02b53 100644 --- a/makima/src/daemon/ws/protocol.rs +++ b/makima/src/daemon/ws/protocol.rs @@ -624,6 +624,9 @@ pub enum DaemonCommand { code: String, message: String, }, + + /// Restart the daemon process. + RestartDaemon, } impl DaemonMessage { |
