fix: add Windows stdin fallback for gbrain put#1366
Closed
ecat2010 wants to merge 1 commit into
Closed
Conversation
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
9 tasks
Owner
|
Closing as superseded by #1325, which fixes the same Windows stdin issue with a one-line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\nFixes
gbrain put <slug>failing on Windows withENOENT: /dev/stdinerror.\n\n## Problem\nsrc/cli.tsreads stdin viareadFileSync('/dev/stdin', 'utf-8'), which only works on Unix. On Windows this throwsENOENT.\n\n## Solution\nWrap stdin reading in try/catch with Windows fallback usingreadSyncon fd 0.\n\n## Changes\n-src/cli.ts: addreadSyncto import\n-src/cli.ts: wrap stdin read in try/catch with Windows fallback\n\n## Testing\n- Tested on Windows 11 withecho "test" | gbrain put test-slug— works correctly\n- Unix behavior unchanged (try block succeeds first)\n\n## Related\nFixes #1362