Output capture fails for Node.js scripts after GitHub restore (Windows PowerShell)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

After restoring files from GitHub, Cursor’s chat window fails to capture Node.js stdout/stderr output. Tests execute correctly in local PowerShell terminal but produce no visible output in chat window.

Steps to Reproduce

  1. Restore files from GitHub (e.g., git restore or git checkout)
  2. Run a Node.js test script via chat: node test/utils/blockchain/test-block-confirmation-manager-unit.js
  3. Observe: No output appears in chat window
  4. Run same command in PowerShell terminal
  5. Observe: Full output appears correctly

Expected Behavior

Output should appear in chat window, matching what appears in local terminal.

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.50 (system setup)
VSCode Version: 1.105.1
Commit: 56f0a83df8e9eb48585fcc4858a9440db4cc7770
Date: 2025-12-06T23:39:52.834Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.19045

For AI issues: which model did you use?

Auto, Composer 1

Additional Information

Output Capture Issue - Summary & Recommendations

Issue Confirmed

After comprehensive investigation, the issue is confirmed to be tool-specific output capture, not a code problem.

Evidence

  1. :white_check_mark: Tests work perfectly in local PowerShell terminal

    • Full output visible (34 tests, all console.log statements)
    • Proper exit codes
    • Complete test execution
  2. :cross_mark: Tool’s chat window does not capture output

    • Same commands produce no visible output in chat
    • Affects all Node.js scripts after GitHub restore
    • Previously working tests also affected
  3. :white_check_mark: Git configuration normalized

    • Set core.autocrlf = false
    • Set core.eol = lf
    • Renormalized line endings with git rm --cached -r . and git reset --hard

Root Cause

This is a tool/environment interaction issue where:

  • The tool’s process execution mechanism fails to capture Node.js stdout/stderr
  • This occurs specifically after GitHub restore operations
  • The issue persists even after Git configuration fixes
  • Local terminal execution works correctly, confirming code is fine

Recommended Actions

Immediate Workaround

Run tests directly in PowerShell terminal (confirmed working):

# Individual test
node test/utils/blockchain/test-block-confirmation-manager-unit.js

# All blockchain unit tests
Get-ChildItem test/utils/blockchain/*-unit.js | ForEach-Object { 
    Write-Host "`n=== Running $_ ===" -ForegroundColor Cyan
    node $_.FullName 
}

# Or use existing test runners
node scripts/ci-cd/run-ci-tests.js

Alternative: Output to File

If you need to review output in the tool:

node test/utils/blockchain/test-block-confirmation-manager-unit.js > test-output.txt 2>&1
# Then read the file in the tool

Long-term Solution

  1. Report as tool issue: This appears to be a bug in the tool’s output capture mechanism
  2. Use local terminal: Continue running tests directly in PowerShell for now
  3. Monitor for updates: Tool may fix this in future versions

Files Investigated

  • :white_check_mark: .gitattributes - Correctly configured (*.js text eol=lf)
  • :white_check_mark: Git config - Normalized to match .gitattributes
  • :white_check_mark: Test files - All use correct process.exit() pattern
  • :white_check_mark: Working tests (arbitrage, accounting) - Same pattern, also affected
  • :white_check_mark: Diagnostic scripts - Also affected, confirming systemic issue

Conclusion

The test code is correct. The issue is with the tool’s ability to capture Node.js output after GitHub restore operations. Use local terminal execution as the workaround until the tool’s output capture is fixed.

Related Documentation

  • docs/testing/GITHUB_RESTORE_OUTPUT_ISSUE.md - Detailed investigation
  • docs/testing/OUTPUT_CAPTURE_FIX.md - Previous (incorrect) hypothesis about process.exit()

Does this stop you from using Cursor

No - Cursor works, but with this issue

Why closing and reloading the project folder worked

The issue was corrupted workspace-level state in the IDE, not the files or Git state.

The difference between methods

  1. Reload Window (Ctrl+Shift+P > “Reload Window”):
  • Reloads the window UI and extensions

  • Keeps workspace state in memory (file watchers, output stream handlers, workspace caches)

  • The corrupted workspace state persisted through the reload

  1. Full Restart (closing Cursor completely):
  • Clears everything, but may reload workspace state from disk cache

  • Slower and may not address workspace-specific corruption

  1. Close Folder (File > Close Folder) — what worked:
  • Unloads the workspace from memory

  • Clears workspace state, file watchers, output stream handlers, and workspace-specific caches

  • Forces a fresh workspace initialization when reopened

  • Faster than a full restart and targets the problem area

Why this matters

After GitHub restore, the IDE’s workspace state can become corrupted:

  • Output stream handlers may have incorrect file descriptors

  • File watchers may have stale references

  • Workspace process execution context may have cached incorrect metadata

Reload Window didn’t fix it because it keeps workspace state in memory. Close Folder fixed it by clearing that state and rebuilding it from scratch.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.