Skip to content

Conversation

@dmitrivMS
Copy link
Contributor

Fixes #145505

According to child_process documentation, when the process cannot be spawned stdout/stderr will be null. Although this is probably a rare case, we should handle that case gracefully.

Copilot AI review requested due to automatic review settings January 2, 2026 00:50
@dmitrivMS dmitrivMS enabled auto-merge January 2, 2026 00:50
@dmitrivMS dmitrivMS self-assigned this Jan 2, 2026
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/src/git.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds defensive null checks for stdout and stderr streams when spawning a child process in the Git extension's getStatus method. According to Node.js child_process documentation, these streams can be null if the process fails to spawn, which could cause runtime errors when attempting to access them.

Key Changes

  • Added optional chaining when removing stdout data listener during status limit handling
  • Wrapped stdout listener setup in a null check to prevent errors when stream is unavailable
  • Wrapped stderr listener setup in a null check to prevent errors when stream is unavailable

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

Labels

git GIT issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot read property 'setEncoding' of undefined

2 participants