mirror of
https://github.com/jackwener/wx-cli.git
synced 2026-10-09 03:15:46 +00:00
fix: 深度 review 修复 10 个 bug/问题
Critical & High: - daemon 日志:启动时将 stdout/stderr 重定向到 ~/.wx-cli/daemon.log 而非 /dev/null,使 wx daemon logs 真正可用 - q_history 找不到聊天时改为 bail! 而非 ok:true+error 字段, 避免 CLI 静默返回空输出 - init 写 config.json 默认路径改为 ~/.wx-cli/config.json, 避免写入系统 bin 目录(/usr/local/bin/config.json) - LIKE 通配符:搜索关键词中的 %/_/\ 现在正确转义 - WAL 路径:改用 OsString.push 拼接 "-wal" 后缀, 避免 display() 在非 UTF-8 路径上失效 - cmd_stop:检查 kill() 返回值,ESRCH 时给出明确提示 Performance & Code quality: - full_decrypt:改为流式逐页读写,峰值内存从 2×文件大小降为 O(1) - Regex:msg_table_re() 用 OnceLock 静态编译,避免热路径重复编译 - mtime_nanos:消除 daemon/mod.rs 与 cache.rs 的重复定义 - use super::super::cli::transport → use super::transport - 删除未使用的 save_config、Request::to_json_line 死代码
This commit is contained in:
+1
-6
@@ -208,12 +208,7 @@ async fn run_watcher(
|
||||
}
|
||||
}
|
||||
|
||||
fn mtime_nanos(path: &std::path::Path) -> u64 {
|
||||
std::fs::metadata(path)
|
||||
.and_then(|m| m.modified())
|
||||
.map(|t| t.duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_nanos() as u64)
|
||||
.unwrap_or(0)
|
||||
}
|
||||
use cache::mtime_nanos;
|
||||
|
||||
fn decompress_or_str(data: &[u8]) -> String {
|
||||
if data.is_empty() { return String::new(); }
|
||||
|
||||
Reference in New Issue
Block a user