Skip to content

fix(runtime): preserve util.promisify.custom on Windows child process hide shims (#695) - #756

Closed
yaojin3616 wants to merge 1 commit into
V0.12.2from
fix/issue-695-windows-execfile-promisify-custom
Closed

yaojin3616 wants to merge 1 commit into
V0.12.2from
fix/issue-695-windows-execfile-promisify-custom

Conversation

@yaojin3616

Copy link
Copy Markdown
Contributor

解决的问题

修复 #695:Windows 下 build/windows-child-process-hide.mjs 重写 childProcess.execFile 与 exec 时丢失挂载在其上的 util.promisify.custom 符号,导致第三方插件在执行 promisify(execFile) 时退化为裸 stdout 字符串,解构 { stdout, stderr } 拿到 undefined,进而抛出 TypeError 崩掉 Harness 子进程。

变更说明

  1. 保留并转发 util.promisify.custom:为 childProcess.exec 与 childProcess.execFile 显式保留自定义 promisify 钩子,自动注入 windowsHide: true 并确保返回标准的 { stdout, stderr } 结构及 promise.child。
  2. 规整 patchedExecFile 参数传递:兼容调用方传入 execFile(file, options, callback)(3 参数形态,args 为 options 对象)时的参数规整化,避免将 options 错位传递给底层 Node。
  3. 单元测试回归:在 test/harness-node-entry.test.ts 中新增对 promisify(execFile) 与 promisify(exec) 完整返回结构的集成回归断言。

验证

  • npm test -- test/harness-node-entry.test.ts 全部 29 个测试用例通过。
  • npm run typecheck 干净通过。
  • git diff --check 无格式异常。

@yaojin3616

Copy link
Copy Markdown
Contributor Author

感谢补齐 Windows promisify 契约和回归测试。对当前 head 的定点执行发现:promisify(execFile)(file, undefined, {encoding:'buffer'}) 会丢弃第三个 options,stdout 实际为 string;二参 execFile(file, callback) 也仍丢失 callback。#711 在同样调用下均保留契约,且覆盖结果、错误与 Promise.child。我已在 #711 记录贡献与测试承接要求,本次将这个不完整的重复实现关闭,统一由 #711 接续。#711 目前仍开放、尚未合并,这不代表主线或正式版已修复;仍需 Windows 实际安装包验收。谢谢贡献!

@yaojin3616 yaojin3616 closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant