stat.isFIFO() is wrongly marked as always false on Windows, even when piping into a node process
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v22.14.0
Platform
Microsoft Windows NT 10.0.26120.0 x64 [although this is on ARM64]
Subsystem
No response
What steps will reproduce the bug?
Running echo '{}' | node -e 'console.log(require("fs").fstatSync(0).mode)' in PowerShell (as cmd doesn't seem to support pipes via the usual syntax) returns 4096, and checking fs.constants, S_IFIFO is set to 4096.
How often does it reproduce? Is there a required condition?
Seems to be all the time on Windows when you try to pipe something in, which is due to a (I assume legacy?) check here: https://github.com/nodejs/node/blob/c3b6f949748b49ef25b0239bd4582d29976fdbad/lib/internal/fs/utils.js#L538-L541
What is the expected behavior? Why is that the expected behavior?
On Windows, stat.isFIFO() should correctly handle pipes and stat.isFIFO() should correctly return true when piped in
What do you see instead?
stat.isFIFO() always returns false on Windows, even if the mode has the flag set
Additional information
I would love to submit a PR to fix this, but I am not sure if those checks are there for a reason or for legacy purposes (it seems that at least the S_ISFIFO is now exposed but it wasn't before [?]), and if it can be edited safely.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führen Sie die gemeldete PowerShell-Pipeline unter Windows aus und untersuchen Sie anschließend die plattformspezifischen Prüfungen in lib/internal/fs/utils.js etwa in den Zeilen 538-541. Ermitteln Sie, warum die FIFO-Erkennung Windows-Pipes ausschließt, und verifizieren Sie, dass stat.isFIFO() im Fall der weitergeleiteten Standardeingabe true zurückgibt, ohne andere Dateitypprüfungen zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100