Conversation
Ghostty prefixes surface commands with exec, breaking directory changes and environment assignments. Wrap the complete command in bash -lc and quote embedded apostrophes before AppleScript escaping. Codex starts with the selected working directory and instance environment.
Direct exec handling can silently skip Codex launch or misread environment assignments. Exercise the generated surface command with directory setup, quoted values, and a failed cd. Regressions fail on missing execution while the command preview remains covered.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
我在 macOS 上使用 Cockpit Tools 时,遇到了从 Codex 实例弹窗选择 Ghostty 后无法启动的问题。排查后尝试加了一层 shell 包装,本地的定向测试和真实 Ghostty 启动验证都通过了,因此提交这个 PR,想请维护者帮忙看看修复方向和实现是否合适。
Why
排查时发现,原实现把
cd ... && CODEX_HOME=... <cli>直接写入 Ghostty surface 的command。Ghostty 的 macOS 启动链添加exec -l后,目录切换后的命令不会执行;省略目录切换时,环境变量赋值会被当作可执行文件。Changes
/bin/bash -lc包装,先引用完整命令,再进行 AppleScript 转义。Verification
rustc --edition=2021 --test独立编译:4 项测试通过。修复前已确认其中两项失败(未执行目标命令、环境赋值被当作程序)。CODEX_HOME均与输入一致。路径含空格、单引号、双引号及中文;使用无账号凭据的测试命令,测试窗口已关闭。git diff --check:通过。cargo test -p cockpit-tools --lib macos_ghostty --locked:上游未修改时即因 Cargo.lock 需要更新而退出,未进入编译。未修改锁文件;本机磁盘空间不足以构建完整 Tauri 应用,因此以上独立编译和真实终端验证不代表完整应用构建通过。Review
这次只验证了本机的 Ghostty 1.3.1,还没有完成整个应用的构建。想请维护者重点看看:这里显式使用
/bin/bash -lc是否符合项目的终端启动方式,以及是否有其他版本或配置需要兼容。如果项目有更合适的处理方式,也欢迎指出。Related Issues
Closes #2312