Conversation
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.
Related to #65
问题
在 Windows 上运行 s11 后台任务示例时,
_stop_process_group()会调用 POSIX 专属的os.killpg和signal.SIGKILL。清理过程发生在
finally中,因此这里的异常会覆盖原本已经成功的命令结果,导致前台和后台命令都被错误标记为失败,也无法正常观察本章要演示的后台任务生命周期。修改内容
Popen.terminate(),超时后使用Popen.kill()清理 Shell 进程。web/package.json。教学行为保持不变
修复后仍然可以观察本章的三个重点:
run_in_background后,命令被送到后台。bg_id,前台可以继续执行其他工具。<task_notification>格式收集结果,并且只收集一次。验证
python -m pytest tests/test_background_tasks.py tests/test_chapter_readmes.py -qnpm --prefix web run build与 Issue #65 的关系
本 PR 解决的是 #65 中 s11 后台任务清理和教学示例的 Windows 兼容问题。
它不代表整个仓库在 Windows 上的全部兼容问题已经解决,因此使用
Related to #65,不自动关闭该 Issue。AI assistance
本 PR 在问题诊断、测试设计和代码检查过程中使用了 OpenAI Codex 辅助。修复内容已由我在 Windows 环境中手动复现、审查并验证。