chore: sync fork with upstream microsoft/node-pty - #90
Closed
bwp91 wants to merge 293 commits into
Closed
Conversation
Copy right dll/exe based on npm_config_arch
Bring back clear impl
Resolves warning: src\win\path_util.cc(54): warning C6262: Function uses '131804' bytes of stack: exceeds /analyze:stacksize '16384'. Consider moving some data to heap.
Fixes warning: deps\winpty\src\agent\Agent.cc(231): warning C4722: 'Agent::~Agent': destructor never returns, potential memory leak
…econstructor Catch possible exceptions in ~Agent
Close piClient.hThread handle
…_heap Move buffer_ to heap
Move from yarn to npm
Follow up microsoft#720
Fix typo in trace log
Move to compile commands on postinstall for fixing intellisense
* chore: use node 20 and fix build * chore: bump macOS deployment target * spec: reduce flakyness * Revert "chore: bump macOS deployment target" This reverts commit d9d18b3. --------- Co-authored-by: deepak1556 <hop2deep@gmail.com>
Also allows the CI pipeline to use the Unofficial template
fix: ensure proper cleanup of console process on shutdown
* Update to conpty v1.22 Fixes microsoft#490 * Add logs to show the problem happening * spec: increase exit delay * refactor: input and output handling with conpty * Close the input read and output write handles after creating the client process * Call ReleasePseudoConsole after creating the client process which will cause the output read handle to close when there is no more data from the session * For manual termination via Kill, we close the input write handle and call into ClosePseudoConsole, we should then drain the output handle NB: ideally draining the output handle should have been enough to cause the client process to close but it doesn't work, we call TerminateProcess to fix this case. * chore: restore legacy conpty path --------- Co-authored-by: deepak1556 <hop2deep@gmail.com>
* chore: add BinSkim flags to winpty * Apply PR feedback
Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.0.1 to 10.2.0. - [Commits](https://github.com/beaugunderson/ip-address/commits) --- updated-dependencies: - dependency-name: ip-address dependency-version: 10.2.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…crosoft#922) The windows backend keeps a global vector of `ptyHandles`. Since the cleanup of the baton was moved into the per-pty watcher thread (commit 17062cd): - The watcher thread called `remove_pty_baton` without any lock, racing with other watchers and with JS-thread reads. - `emplace_back` in `startProcess` could reallocate the vector while another thread was iterating it.
) Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 5.0.5 to 5.0.6. - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](juliangruber/brace-expansion@v5.0.5...v5.0.6) --- updated-dependencies: - dependency-name: brace-expansion dependency-version: 5.0.6 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Initial plan * chore(examples/electron): update electron to 42.2.0 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* Initial plan * chore: bump eslint to 10.4.0 * chore: declare globals for eslint config --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
SetupExitCallback opens a kqueue() per spawned pty to wait on NOTE_EXIT, but never closes it before the watcher thread returns, leaking one kqueue fd per pty.spawn() for the host process lifetime. The Chromium kill_mac.cc this is based on closes the kqueue via ScopedFD; the equivalent here is an explicit close(kq) once the kevent wait completes.
…icrosoft#930) Bumps [undici](https://github.com/nodejs/undici) from 7.27.0 to 7.28.0. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](nodejs/undici@v7.27.0...v7.28.0) --- updated-dependencies: - dependency-name: undici dependency-version: 7.28.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.1 to 4.2.0. - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](nodeca/js-yaml@4.1.1...4.2.0) --- updated-dependencies: - dependency-name: js-yaml dependency-version: 4.2.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.11 to 7.5.16. - [Release notes](https://github.com/isaacs/node-tar/releases) - [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md) - [Commits](isaacs/node-tar@v7.5.11...v7.5.16) --- updated-dependencies: - dependency-name: tar dependency-version: 7.5.16 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…eption on Windows (microsoft#934)
* chore: onboard to ADO feed * Fix relative path
Brings the fork up to date with upstream (fork point was Oct 2023): - winpty support removed (deps/winpty deleted; Windows uses conpty only) - NAPI-era native code with upstream's fd-leak, shutdown, and backpressure fixes; Buffer write API; pixel-size resize - upstream's centralised loadNativeModule loader, extended here to find the fork's abi-tagged bundled prebuilds first - modern toolchain: TypeScript 5, ESLint 10 flat config, node-gyp 11 Fork keeps: package identity, prebuild-install install chain, bundled linux prebuilds, multiarch release workflows, engines range. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All native loading now goes through loadNativeModule in utils.ts (which handles the fork's abi-tagged bundled prebuilds); nothing imports prebuild-loader any more. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
prebuild-install downloads the prebuild published for the current package version during npm ci, so tests were running against the stale v0.13.1 binary instead of the code in the checkout - the new fd-leak regression tests correctly failed against it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bwp91
force-pushed
the
sync/upstream-main
branch
from
July 19, 2026 15:49
c8037bd to
8552f6f
Compare
Node.js (since the CVE-2024-27980 fix) refuses to spawn .cmd files without shell: true, so the source-build fallback in scripts/install.js crashed on any Windows machine with no matching prebuild - such as win32-arm64, which has no published prebuilds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.16 to 7.5.22. - [Release notes](https://github.com/isaacs/node-tar/releases) - [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md) - [Commits](isaacs/node-tar@v7.5.16...v7.5.22) --- updated-dependencies: - dependency-name: tar dependency-version: 7.5.22 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Conflicts: # package-lock.json
…-main # Conflicts: # .npmignore # eslint.config.js # package-lock.json # package.json # src/windowsTerminal.test.ts
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.
What this is
A full sync of this fork with upstream
microsoft/node-pty, done as a true git merge so GitHub reports the fork as 0 commits behind upstream. The fork point was October 2023 — this brings in ~284 upstream commits while keeping the fork's packaging and multiarch prebuild distribution intact.What we gain from upstream
Bug fixes relevant to real users:
/dev/ptmxfile-descriptor leak fixed (fix: /dev/ptmx leak on macOS microsoft/node-pty#882) and kqueue fd leak fixed (fix: close kqueue fd in SetupExitCallback on macOS microsoft/node-pty#931) — long-running processes no longer slowly exhaust file handles as terminals open/closeEAGAIN), fixing potential data loss when large amounts of data are written fastCreateProcessWfailures surfaced asexitevents instead of uncaught exceptions (fix: surface CreateProcessW failures as 'exit' instead of uncaughtException on Windows microsoft/node-pty#934), handle/attribute-list cleanup on failed conpty spawns (fix: close pipe handles and free attribute list when conpty spawn fails microsoft/node-pty#935), pid set correctly after agent connection (freeze when using debugger on windows microsoft/node-pty#763)dataand other events (Avoid excessive listeners on data and other events microsoft/node-pty#841)Features (all additive):
write()acceptsBufferas well as stringsresize()supports optional pixel dimensionsuseConptyDllmode with bundled conpty 1.25 (third_party/conpty)Structural:
deps/winptytree (185 files) is gone. Windows uses conpty only, which requires Windows 10 1809+ (October 2018). Older builds are long EOL and Node 18+ barely runs there; noted as a footnote rather than a breaking change/sdl,-fstack-protector-strong)Merge policy used
src/,typings/,binding.gyp,scripts/post-install.js, eslint configdeps/winpty,src/win/winpty.cc,.eslintrc.js,.npmrc,azure-pipelines.ymlREADME.md, package identity, release workflows,.prebuild/package.jsonpackage.json: keeps the fork's name/version,prebuild-installinstall chain (check-prebuild → prebuild-install → node-gyp), bundled linux prebuilds infiles,engines,overrides, andallowScripts; adopts upstream's devDependency toolchain; dropsdeps/fromfiles(winpty is gone); ships upstream'sthird_party/conpty payload.The one deliberate code divergence: upstream centralised native loading in
loadNativeModule()(src/utils.ts), which only looks for plain names likepty.node. This fork's bundled linux prebuilds use prebuildify's abi-tagged names (e.g.node.abi127.node).loadNativeModule()gained a small, clearly-commented fork preamble that consults the existingprebuild-file-pathhelper first, then falls through to upstream's search order.src/prebuild-loader.tsbecame orphaned as a result and is removed in a follow-up commit.Impact on homebridge-config-ui-x
None expected. The UI uses
spawn()+onData/onExit/write/resize/kill, all unchanged. Linux prebuild coverage (incl. armv6/v7 and musl) is produced by this repo's own workflows, which are untouched. macOS continues to build from source for now (#92 — which becomes much easier after this merge, since upstream's loader already reads plain-named binaries fromprebuilds/<platform>-<arch>/; bundling darwin/win32 prebuilds in the published package is the planned follow-up).Testing done (macOS arm64)
npm installwith regenerated lockfile — cleantscbuild andeslint(flat config) — cleannode-gyp rebuildfrom merged native source, then 24/24 mocha tests pass, including upstream's new ptmx/kqueue fd-leak regression testsnpm installpulls the published v0.13.1 prebuild viaprebuild-install, which masks merged native changes — rebuild withnpx node-gyp rebuildbefore running testsOther platforms need CI + the prebuild workflows to validate. Suggest releasing the next version as a beta and soaking it in a config-ui-x beta before stable.
🤖 Generated with Claude Code