From 7681e69e681dba7e711d338bfbb5521c29a6ba74 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 13 May 2026 14:11:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Wired=20--tcp=20into=20daemon=20stop=20?= =?UTF-8?q?command=20with=20manual-stop=20warning;=20st=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - src/cli/daemon_cmd.rs GSD context: - Milestone: M001 - TCP Transport - Slice: S02 - Task: T02 - Wired --tcp into daemon stop command with manual-stop warning; status already reports TCP vs local GSD-Task: S02/T02 --- src/cli/daemon_cmd.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cli/daemon_cmd.rs b/src/cli/daemon_cmd.rs index 03f1127..82c32d0 100644 --- a/src/cli/daemon_cmd.rs +++ b/src/cli/daemon_cmd.rs @@ -6,7 +6,7 @@ use crate::cli::transport; pub fn cmd_daemon(cmd: DaemonCommands, tcp_addr: Option<&str>) -> Result<()> { match cmd { DaemonCommands::Status => cmd_status(tcp_addr), - DaemonCommands::Stop => cmd_stop(), + DaemonCommands::Stop => cmd_stop(tcp_addr), DaemonCommands::Logs { follow, lines } => cmd_logs(follow, lines), DaemonCommands::Start { tcp } => crate::daemon::run_start(tcp), } @@ -29,7 +29,17 @@ fn cmd_status(tcp_addr: Option<&str>) -> Result<()> { Ok(()) } -fn cmd_stop() -> Result<()> { +fn cmd_stop(tcp_addr: Option<&str>) -> Result<()> { + // TCP daemon is a separate process — cannot stop via PID file + if let Some(addr) = tcp_addr { + eprintln!( + "⚠ TCP daemon ({}) 是一个独立进程,无法通过 `wx daemon stop` 停止。\n\ + 请手动关闭该进程(例如 kill / taskkill PID)。", + addr + ); + return Ok(()); + } + let pid_path = config::pid_path(); if !pid_path.exists() { println!("daemon 未运行");