Skip to content

fix: add Windows stdin fallback for gbrain put#1366

Closed
ecat2010 wants to merge 1 commit into
garrytan:masterfrom
ecat2010:fix/windows-stdin-clean
Closed

fix: add Windows stdin fallback for gbrain put#1366
ecat2010 wants to merge 1 commit into
garrytan:masterfrom
ecat2010:fix/windows-stdin-clean

Conversation

@ecat2010
Copy link
Copy Markdown

Summary\nFixes gbrain put <slug> failing on Windows with ENOENT: /dev/stdin error.\n\n## Problem\nsrc/cli.ts reads stdin via readFileSync('/dev/stdin', 'utf-8'), which only works on Unix. On Windows this throws ENOENT.\n\n## Solution\nWrap stdin reading in try/catch with Windows fallback using readSync on fd 0.\n\n## Changes\n- src/cli.ts: add readSync to import\n- src/cli.ts: wrap stdin read in try/catch with Windows fallback\n\n## Testing\n- Tested on Windows 11 with echo "test" | gbrain put test-slug — works correctly\n- Unix behavior unchanged (try block succeeds first)\n\n## Related\nFixes #1362

On Windows, readFileSync('/dev/stdin') throws ENOENT because
/dev/stdin does not exist. This commit adds a try/catch
with a Windows fallback using readSync on fd 0.

Fixes garrytan#1362
@garrytan
Copy link
Copy Markdown
Owner

Closing as superseded by #1325, which fixes the same Windows stdin issue with a one-line readFileSync(0, ...) change (the canonical Node cross-platform stdin idiom). Both fixes land together in the v0.41.4.0 community-PR-wave at #1377. Thank you for catching this — your investigation surfaced the bug class even if a different fix shape shipped. Co-authorship credit preserved.

@garrytan garrytan closed this May 24, 2026
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.

2 participants