Repository navigation
windows: 改用隐藏 VBS 启动器,避免登录后弹出终端 - #7
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac03e157c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let command = format!( | ||
| "cmd.exe /c {}", | ||
| watch_command_line( |
There was a problem hiding this comment.
Wrap /c payload in outer quotes for cmd.exe
The new VBS launcher builds cmd.exe /c with an already-quoted executable path, but without outer quotes around the full /c payload. For common installs where the binary path contains spaces (for example under C:\Program Files), cmd's documented /c quote parsing will strip the leading quote pair when the payload contains multiple quoted segments, which breaks command resolution and prevents the Startup entry from launching watch at login. Please wrap the entire command string passed to /c (the usual ""..."" pattern) or invoke the executable without this extra cmd.exe /c layer.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
你说得对。当前实现把已经带引号的可执行路径直接拼到了 cmd.exe /c 后面,没有再给整个 /c payload 做外层包装;在 Program Files 这类带空格路径下,这样确实可能被 cmd 误解析。
这里我已经改成直接让 VBS 调用已经正确加引号的可执行路径和参数,去掉了 cmd.exe /c 这一层,这样可以彻底绕开 cmd 的引号规则。
|
感谢 PR,正好缺少在 Windows 上的实机测试反馈。 |
感谢合并和follow-up的加固 commit。在 L 站看到了你的项目,很符合我目前遇到的问题和需求,感谢你的开源。 |
变更目的
修复 Windows 下
install-service的使用体验问题。当前 Windows 实现会在 Startup 文件夹里写入一个
.cmd启动脚本。用户登录后,系统会拉起一个可见的控制台窗口来执行watch。这会带来两个问题:这次改动
本 PR 仅针对 Windows 做一个最小修复:
.cmd改为隐藏窗口的.vbsinstall-service时清理旧版遗留的.cmduninstall-service时兼容删除.vbs和旧版.cmdcurrent_service_status()在 Windows 下兼容识别旧版.cmd,避免升级后误判为“未安装”为什么不改成 schtasks / 真正的 Windows Service
本仓库当前已经明确选择了 Startup 文件夹方案。这次 PR 保持现有架构不变,只修复“登录时弹终端”这个核心体验问题,避免范围扩大。
有意不处理的范围
这次 PR 不尝试解决 Windows 登录后启动链路与 detached watch 的 pid/log/status 语义完全统一的问题。这个问题如果要处理,建议单独开一个 PR 做更完整的设计和讨论。
测试说明
shell.Run ..., 0, Falsecargo到 PATH,本地未完成完整cargo test回归;这部分建议在 CI 中继续覆盖