File descriptor 0 might not get closed when used in file stream
Open
Nobody has claimed this yet.
fs
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
Just from reading the code it seems the file descriptor 0 is not closed for streams.
I have not run any tests to confirm that, but the check in code if (!stream.fd) looks rather clear and does not work for fd 0. The _close function actually sets null, so more null-like check should be there:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked sections of lib/internal/fs/streams.js, especially lines 117-134, and trace how the stream’s file descriptor is checked and cleared. Confirm the behavior for descriptor 0 and add coverage for the reported case; done means descriptor 0 is closed without regressing other stream cleanup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100