Skip to content

Conversation

@arnav-54
Copy link

@arnav-54 arnav-54 commented Dec 1, 2025

🛠 Fix: Add defensive try/catch around stat() in Windows symlink logic

This PR adds a small defensive wrapper around the stat() call used during
symlink creation on Windows. In certain environments, stat() may throw
synchronously rather than returning an error, which can crash the Node.js
process. Catching this ensures the code fails safely instead of terminating.

Why this matters

  • Prevents rare but real crashes: handles synchronous stat() throws.
  • Graceful fallback: falls back to the standard symlink creation path.
  • Minimal, targeted change: only adds a simple try/catch and comment.
  • Windows-specific: no impact on other platforms or code paths.

Summary

A small but meaningful defensive improvement that improves Windows stability
while preserving existing behavior and keeping the change surface minimal.

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Dec 1, 2025
@arnav-54
Copy link
Author

arnav-54 commented Dec 1, 2025

can you please review it @technoweenie @mojodna @bmizerany

@arnav-54
Copy link
Author

arnav-54 commented Dec 2, 2025

Hi, this PR adds a small defensive try/catch around stat() in the Windows symlink code path.
This avoids a rare synchronous crash when stat() throws on certain Windows setups.

It’s a minimal change (just a try/catch) and falls back to default symlink behavior.

Whenever possible, could someone approve the workflows so CI can run?
Thanks!

@arnav-54
Copy link
Author

arnav-54 commented Dec 2, 2025

@aduh95 please review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants