Skip to content

fix: make stdin not blocking in doctor user tests#6970

Open
robertolopezlopez wants to merge 9 commits into
mainfrom
fix/CLI-1638
Open

fix: make stdin not blocking in doctor user tests#6970
robertolopezlopez wants to merge 9 commits into
mainfrom
fix/CLI-1638

Conversation

@robertolopezlopez

@robertolopezlopez robertolopezlopez commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

User description

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Commit messages
    are release-note ready, emphasizing
    what was changed, not how.
  • Includes detailed description of changes
  • Contains risk assessment (Low | Medium | High)
  • Highlights breaking API changes (if applicable)
  • Links to automated tests covering new functionality
  • Includes manual testing instructions (if necessary)
  • Updates relevant GitBook documentation (PR link: ___)
  • Includes product update to be announced in the next stable release notes

What does this PR do?

Where should the reviewer start?

How should this be manually tested?

What's the product update that needs to be communicated to CLI users?


PR Type

Bug fix, Tests


Description

  • Fixes stdin blocking in tests.

  • Updates doctor test command.

  • Enhances test reliability.


Diagram Walkthrough

flowchart LR
  A[runCommand.ts utility] -- "Unblocks stdin for" --> B(doctor.spec.ts tests)
Loading

File Walkthrough

Relevant files
Tests
doctor.spec.ts
Update doctor live test command                                                   

test/jest/acceptance/doctor.spec.ts

  • Modified the doctor test command to explicitly use the --live flag.
  • Removed redundant logging of stderr.
+2/-4     
Bug fix
runCommand.ts
Unblock stdin for spawned commands                                             

test/jest/util/runCommand.ts

  • Added child.stdin?.end() to the spawned process.
  • This prevents stdin from blocking commands like doctor that read until
    EOF.
+2/-0     

@snyk-io

snyk-io Bot commented Jul 7, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@robertolopezlopez robertolopezlopez force-pushed the fix/CLI-1638 branch 2 times, most recently from 4f8542d to 2639ea4 Compare July 7, 2026 10:24
@robertolopezlopez robertolopezlopez marked this pull request as ready for review July 7, 2026 10:52
@robertolopezlopez robertolopezlopez requested a review from a team as a code owner July 7, 2026 10:52
@robertolopezlopez

Copy link
Copy Markdown
Contributor Author

/describe

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Description updated to latest commit (7559971)

@snyk-pr-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Global Side Effect 🟠 [major]

The change to the shared runCommand utility unconditionally closes the stdin stream for every process spawned. While this prevents hangs in commands that read until EOF (like snyk doctor), it breaks the ability for any other test to pipe input to the CLI. This behavior should be configurable (e.g., via an option) or only triggered if no input data is provided to the helper.

child.stdin?.end();
📚 Repository Context Analyzed

This review considered 3 relevant code sections from 2 files (average relevance: 0.99)

🤖 Repository instructions applied (from AGENTS.md)

@PeterSchafer PeterSchafer force-pushed the feat/CLI-1589_snyk_doctor branch from 85cfd22 to dbfede2 Compare July 7, 2026 13:00
@CatalinSnyk CatalinSnyk force-pushed the feat/CLI-1589_snyk_doctor branch 2 times, most recently from f0e03fc to 829d0ad Compare July 7, 2026 17:07
@PeterSchafer PeterSchafer force-pushed the feat/CLI-1589_snyk_doctor branch from 829d0ad to 1090379 Compare July 7, 2026 17:15
Base automatically changed from feat/CLI-1589_snyk_doctor to main July 7, 2026 17:59
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.

5 participants