Repository navigation
feat(jobs): Windows virtual-sleep Stopped carrier — proposal A stand-down (Refs #3467) - #3567
caomengxuan666 wants to merge 1 commit into
Conversation
…l is live (Refs #3467) Proposal A for the virtual-sleep Stopped carrier (#3467): the Windows `sleep` fast path is an emulation OF the PATH-resolved sleep (an unresolvable one never reaches the emulation — "command not found"), and a virtual sleep has no process to suspend or resume. While the foreground-stop channel is live it stands down to the real child it stands in for — the same rule unix applies under the job-control channel (rubash#2398); GNU's sleep is always a forked child whose stop waitchld observes (jobs.c:4077). On unix foreground_stop_channel_active IS job_control_channel_active, so the unix gate is unchanged. Pin: issue3467_ctrl_z_stops_foreground_sleep_and_fg_resumes_it (fails at the "armed" assert without this commit). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
【WIN-AGENT-AUDIT】 机制核查:
腿(逐项给数字与名字,不许只写「全绿」):
阻塞项(为什么 PENDING 而不是 PASS):
F 点:无(未建议 FAIL)。 续作记录:本轮未动代码。 未跑/VOID 的腿:
|
|
【WIN-AGENT-AUDIT】 本轮复核(只核阻塞条件):
结论:不合、不关。等 s10 车道的 #3538 先落 master + niubash fixture 修正后,本 PR update-branch 重验。 |
|
【P1 车道复核 · #3467 三选一裁决】superseded by #3746(不关闭本 PR) 本 PR 的 base 是 #3538(
即:duplicate + superseded,不是构建/pin 红的淘汰,而是载体裁决落败(#3746 未采用提案 A)。 未关闭、未合并;#3467 保持 OPEN。若后续要恢复「常驻让位」语义(例如让 |
Refs #3467 — 叠在 #3538 之上(base =
fix/3467-windows-fg-ctrl-z-stop),等 #3467 上的载体裁决(提案 A)修了什么
虚拟
sleep的 Stopped 载体按提案 A 实现:Windows 停止通道活跃时(interactive +monitor+ 顶层 + 非命令替换),sleep仿真让位给它所仿真的 PATH 上真实 sleep 子进程,于是 #3538 的可停止前台等待能挂起它;jobs显示 Stopped,fg/bg恢复。这和 unix 上 #2398/#2836 的 stand-down 是同一条规则,只改了command_dispatch_primary.rs里的一个门:cfg!(unix) && (job_control_channel_active || ..._in_subshell)改成foreground_stop_channel_active || ..._in_subshell。unix 上foreground_stop_channel_active就是job_control_channel_active,所以 unix 的门不变。不需要新的 PATH 判断:Windows 的
sleep仿真本来就是"对已解析到的 sleep 的仿真"(type sleep→sleep is a shell emulation of …/sleep.exe)。PATH 上没有 sleep 时根本到不了仿真,直接 127。删了什么
无。
GNU 依据
GNU 的
sleep永远是 fork 出来的子进程,它的停止由waitchld的WUNTRACED观察到(jobs.c:4077);进程内的虚拟 sleep 没有可以挂起或恢复的进程。验证
issue3467_ctrl_z_stops_foreground_sleep_and_fg_resumes_it:本提交前红(在 "armed" 断言处失败:虚拟 sleep 不持停止窗口);本提交后绿。本机 PATH 上有 winuxcmd 的sleep.exe,所以这条确实跑到了,没有走早退分支。完整 pin 7/7。shell::tests::issue698_untrapped_ctrl_c_during_foreground_command_keeps_the_session、issue698_ignored_ctrl_c_during_foreground_command_completes_it、issue863_reader_batch_ctrl_c_during_foreground_command_keeps_the_session往 PATH 里放了一个占位的sleep.exe,专门用来走进程内仿真。A 生效后,交互 monitor 会话会真的去 spawn 这个占位文件,报os error 216,3 条变红。实测:feat(jobs): Windows foreground Ctrl+Z stop surface — inject_console_ctrl_z + Stopped arm (Refs #3467) #3538 单独时 niubash ctrl_c 相关 20/20 绿;叠上 A 后 17/20。合入 A 之前,需要先把这 3 条 fixture 改成set +m(它们测的是仿真路径本身),或者改用真实的 sleep。Owed
cat/sed仿真的同类让位(unix [bug] Interactive shell stops itself on ^Z instead of only the foreground job #2836 slice 5)在 Windows 上没有跟进。