René's URL Explorer Experiment


Title: Windows anonymous pipes do not work with createReadStream · Issue #57288 · nodejs/node · GitHub

Open Graph Title: Windows anonymous pipes do not work with createReadStream · Issue #57288 · nodejs/node

X Title: Windows anonymous pipes do not work with createReadStream · Issue #57288 · nodejs/node

Description: Version Tested with 22.14.0 and 20.18.1 Platform Microsoft Windows NT 10.0.22000.0 x64 Subsystem No response What steps will reproduce the bug? C# example for the anonymous pipe generator: using System; using System.Diagnostics; using Sy...

Open Graph Description: Version Tested with 22.14.0 and 20.18.1 Platform Microsoft Windows NT 10.0.22000.0 x64 Subsystem No response What steps will reproduce the bug? C# example for the anonymous pipe generator: using Sy...

X Description: Version Tested with 22.14.0 and 20.18.1 Platform Microsoft Windows NT 10.0.22000.0 x64 Subsystem No response What steps will reproduce the bug? C# example for the anonymous pipe generator: using Sy...

Opengraph URL: https://github.com/nodejs/node/issues/57288

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Windows anonymous pipes do not work with createReadStream","articleBody":"### Version\n\nTested with 22.14.0 and 20.18.1\n\n### Platform\n\n```text\nMicrosoft Windows NT 10.0.22000.0 x64\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nC# example for the anonymous pipe generator:\n\n```csharp\nusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.IO.Pipes;\nusing System.Threading.Tasks;\n\nnamespace DotNetSide\n{\n    class Program\n    {\n        static async Task Main(string[] args)\n        {\n            using var pipeWriter = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable);\n            using var pipeReader = new AnonymousPipeServerStream(PipeDirection.In, HandleInheritability.Inheritable);\n\n            Process client = new Process();\n\n            client.StartInfo.FileName = \"node\";\n            client.StartInfo.Arguments = \"yourscript.js \" + pipeWriter.GetClientHandleAsString() + \" \" + pipeReader.GetClientHandleAsString();\n            client.StartInfo.UseShellExecute = false;\n            client.Start();\n\n            pipeWriter.DisposeLocalCopyOfClientHandle();\n            pipeReader.DisposeLocalCopyOfClientHandle();\n\n            _ = StartReadingAsync(pipeReader);\n\n            using var sw = new StreamWriter(pipeWriter)\n            {\n                AutoFlush = true\n            };\n\n            string message = Console.ReadLine();\n\n            while (message != \"exit\")\n            {\n                await sw.WriteAsync(message);\n                message = Console.ReadLine();\n            }\n\n            client.Close();\n        }\n\n        private static async Task StartReadingAsync(AnonymousPipeServerStream pipeReader)\n        {\n            try\n            {\n                StreamReader sr = new StreamReader(pipeReader);\n\n                while (true)\n                {\n                    var message = await sr.ReadLineAsync();\n\n                    if (message != null)\n                    {\n                        Console.WriteLine(message);\n                    }\n                }\n            }\n            catch (Exception ex)\n            {\n                Console.WriteLine(ex);\n            }\n        }\n    }\n}\n```\n\nJS code that should be able to read and write from the pipes' file descriptors:\n\n```js\nconst fs = require('fs');\nconst reader = fs.createReadStream(null, {fd: parseInt(process.argv[2], 10)});\nconst writer = fs.createWriteStream(null, {fd: parseInt(process.argv[3], 10)});\n\nreader.on('data', data => writer.write('echo: ' + data + '\\n'));\n\nsetInterval(()=> {}, 1000 * 60 * 60);\n```\n\n[Source](https://github.com/kblok/DotNetNodeInterprocessCommunication), should work according to the documentation and other examples I've seen.\n\n### How often does it reproduce? Is there a required condition?\n\nEverytime I try to open an inherited anonymous pipe with NodeJS\n\n### What is the expected behavior? Why is that the expected behavior?\n\n``'data'`` events should be emitted when read pipes have new data, and it should be possible to send data to write pipes too.\n\n### What do you see instead?\n\nWhenever I bind a callback to a ReadStream created from a pipe's FD:\n\n```\nnode:events:496\n      throw er; // Unhandled 'error' event\n      ^\n\nError: EBADF: bad file descriptor, close\nEmitted 'error' event on ReadStream instance at:\n    at emitErrorNT (node:internal/streams/destroy:169:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:128:3)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {\n  errno: -4083,\n  code: 'EBADF',\n  syscall: 'close'\n}\n```\n\nWhenever I try to write to a WriteStream created from a pipe's FD:\n```\nnode:events:496\n      throw er; // Unhandled 'error' event\n      ^\n\nError: EBADF: bad file descriptor, close\nEmitted 'error' event on WriteStream instance at:\n    at emitErrorNT (node:internal/streams/destroy:169:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:128:3)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {\n  errno: -4083,\n  code: 'EBADF',\n  syscall: 'close'\n}\n```\n\n### Additional information\n\nThe same Anonymous pipe generator C# program given as an example works well with C++ using the Windows API, so it's not a C# problem:\n```cpp\n#include \u003ciostream>\n#include \u003cstring>\n#include \u003cwindows.h>\n#include \u003carray>\n\nint main(int argc, const char** argv)\n{\n    std::string pipeHandleString = argv[1];\n    int pipeHandleInt = std::stoi(pipeHandleString);\n\n    HANDLE pipeHandle = (void*)pipeHandleInt;\n\n    std::array\u003cchar, 256> buffer = {};\n\n    DWORD numberOfBytesRead;\n\n    BOOL result = false;\n\n    while (result = ReadFile(pipeHandle, &buffer, 256, &numberOfBytesRead, nullptr)) {\n        buffer[numberOfBytesRead] = '\\0';\n        std::cout \u003c\u003c \"echo: \" \u003c\u003c buffer.data() \u003c\u003c std::endl;\n    }\n}\n```\n\nOf course, it also works with C# clients.","author":{"url":"https://github.com/mgirolet-gl","@type":"Person","name":"mgirolet-gl"},"datePublished":"2025-03-03T12:23:25Z","url":"https://github.com/nodejs/node/issues/57288"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:04c6a9e1-da9e-bf0e-ef10-7862efc96031
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCD16:3075D4:48BE75:5E82EB:6AED245E
html-safe-nonce36b4f4242eeac94c9adcba9aeb2acd757942b58309ae9fc1632b842779eac832
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDE2OjMwNzVENDo0OEJFNzU6NUU4MkVCOjZBRUQyNDVFIiwidmlzaXRvcl9pZCI6Ijc4NTE3MzE0NTA1MDE4NjY1OTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac05823326b4de9c7f436d3f54a680af05c3bf16192f1a95aae96bd7df1ead4918
hovercard-subject-tagissue:2891101793
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/57288/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4fd31538003f9cf2fa550ddc029376eafafbb6471b330312ef8e21ec585ce76c/nodejs/node/issues/57288
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4fd31538003f9cf2fa550ddc029376eafafbb6471b330312ef8e21ec585ce76c/nodejs/node/issues/57288
og:image:altVersion Tested with 22.14.0 and 20.18.1 Platform Microsoft Windows NT 10.0.22000.0 x64 Subsystem No response What steps will reproduce the bug? C# example for the anonymous pipe generator: using Sy...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemgirolet-gl
hostnamegithub.com
expected-hostnamegithub.com
None9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release98b41fa4b5635ceb45a4c54320fced73817ff290
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/57288#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F57288
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F57288
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/57288
Reloadhttps://github.com/nodejs/node/issues/57288
Reloadhttps://github.com/nodejs/node/issues/57288
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues657 (657)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/57288
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/57288
#63851https://github.com/nodejs/node/pull/63851
Windows anonymous pipes do not work with createReadStreamhttps://github.com/nodejs/node/issues/57288#top
#63851https://github.com/nodejs/node/pull/63851
libuvIssues and PRs related to the libuv dependency or the uv binding.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22libuv%22
streamIssues and PRs related to Node.js streams.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stream%22
https://github.com/mgirolet-gl
mgirolet-glhttps://github.com/mgirolet-gl
on Mar 3, 2025https://github.com/nodejs/node/issues/57288#issue-2891101793
Sourcehttps://github.com/kblok/DotNetNodeInterprocessCommunication
https://github.com/mgirolet-gl
mgirolet-glhttps://github.com/mgirolet-gl
on Mar 3, 2025https://github.com/nodejs/node/issues/57288#issuecomment-2694675539
expects a an actual file descriptorhttps://github.com/nodejs/node/blob/47a59bde2aadb3ad1b377c0ef12df7abc28840e9/deps/uv/src/win/fs.c#L839
uv__get_osfhandlehttps://github.com/nodejs/node/blob/47a59bde2aadb3ad1b377c0ef12df7abc28840e9/deps/uv/src/win/handle-inl.h#L166-L178
_get_osfhandlehttps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-170
_open_osfhandlehttps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/open-osfhandle?view=msvc-170
_get_osfhandlehttps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-170
_open_osfhandlehttps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/open-osfhandle?view=msvc-170
https://github.com/juanarbol
juanarbolhttps://github.com/juanarbol
on Mar 3, 2025https://github.com/nodejs/node/issues/57288#issuecomment-2694688135
https://github.com/saghul
saghulhttps://github.com/saghul
on Mar 3, 2025https://github.com/nodejs/node/issues/57288#issuecomment-2694701203
https://github.com/bnoordhuis
bnoordhuishttps://github.com/bnoordhuis
on Mar 3, 2025https://github.com/nodejs/node/issues/57288#issuecomment-2695444117
https://github.com/mgirolet-gl
mgirolet-glhttps://github.com/mgirolet-gl
on Mar 4, 2025https://github.com/nodejs/node/issues/57288#issuecomment-2696460980
https://github.com/saghul
saghulhttps://github.com/saghul
on Mar 4, 2025https://github.com/nodejs/node/issues/57288#issuecomment-2696529694
jakecastellihttps://github.com/jakecastelli
streamIssues and PRs related to Node.js streams.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stream%22
libuvIssues and PRs related to the libuv dependency or the uv binding.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22libuv%22
on Mar 13, 2025https://github.com/nodejs/node/issues/57288#event-16722745414
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Apr 20, 2026https://github.com/nodejs/node/issues/57288#issuecomment-4277987993
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Apr 20, 2026https://github.com/nodejs/node/issues/57288#event-24662582328
https://github.com/giroletm
giroletmhttps://github.com/giroletm
on Apr 23, 2026https://github.com/nodejs/node/issues/57288#issuecomment-4303192781
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Apr 24, 2026https://github.com/nodejs/node/issues/57288#event-24820019520
PickBashttps://github.com/PickBas
on Jun 9, 2026https://github.com/nodejs/node/issues/57288#event-26521820884
win,unix: add uv_pipe_open_exhttps://github.com/JaneaSystems/libuv/commit/9eb446e364deb7ad5c9f1beac08fdee64a3ab2f2
9eb446ehttps://github.com/JaneaSystems/libuv/commit/9eb446e364deb7ad5c9f1beac08fdee64a3ab2f2
win,unix: add uv_pipe_open_exhttps://github.com/JaneaSystems/libuv/commit/3ff2d5dc6ad16dea16acd13df67ac31a794456b2
3ff2d5dhttps://github.com/JaneaSystems/libuv/commit/3ff2d5dc6ad16dea16acd13df67ac31a794456b2
win,unix: add uv_pipe_open_exhttps://github.com/JaneaSystems/libuv/commit/36fa5e81d378cc10cd22ae6c4828749b877d86cf
36fa5e8https://github.com/JaneaSystems/libuv/commit/36fa5e81d378cc10cd22ae6c4828749b877d86cf
fs: add windowsHandle option to file streamshttps://github.com/JaneaSystems/node/commit/0067917b7c94baf92118e90cbd5c120f790762f0
0067917https://github.com/JaneaSystems/node/commit/0067917b7c94baf92118e90cbd5c120f790762f0
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jul 24, 2026https://github.com/nodejs/node/issues/57288#issuecomment-5065303258
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jul 24, 2026https://github.com/nodejs/node/issues/57288#event-28413081615
https://github.com/giroletm
giroletmhttps://github.com/giroletm
on Jul 25, 2026https://github.com/nodejs/node/issues/57288#issuecomment-5081074986
#63851https://github.com/nodejs/node/pull/63851
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jul 26, 2026https://github.com/nodejs/node/issues/57288#event-28488544528
PickBashttps://github.com/PickBas
on Aug 6, 2026https://github.com/nodejs/node/issues/57288#event-29065153881
fs: add windowsHandle option to file streamshttps://github.com/JaneaSystems/node/commit/329b98f67bca609387dd9070074dec3adc8a0a8c
329b98fhttps://github.com/JaneaSystems/node/commit/329b98f67bca609387dd9070074dec3adc8a0a8c
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#63851https://github.com/nodejs/node/pull/63851
on Aug 6, 2026https://github.com/nodejs/node/issues/57288#event-29087733347
pullhttps://github.com/apps/pull
on Aug 6, 2026https://github.com/nodejs/node/issues/57288#event-29087743608
fs: add windowsHandle option to file streamshttps://github.com/Ballalhossaintalukder/node/commit/d9d4446bec644d48c7d9c8fbc890f17cadb11d87
d9d4446https://github.com/Ballalhossaintalukder/node/commit/d9d4446bec644d48c7d9c8fbc890f17cadb11d87
aduh95https://github.com/aduh95
on Aug 13, 2026https://github.com/nodejs/node/issues/57288#event-29399889462
fs: add windowsHandle option to file streamshttps://github.com/nodejs/node/commit/8a362438c46eb10ba55ca9865823ce555bb3956c
8a36243https://github.com/nodejs/node/commit/8a362438c46eb10ba55ca9865823ce555bb3956c
aduh95https://github.com/aduh95
on Aug 25, 2026https://github.com/nodejs/node/issues/57288#event-30010523170
fs: add windowsHandle option to file streamshttps://github.com/nodejs/node/commit/656cfaeb2d54000aa6e9b0abd6e469f0fe217d2d
656cfaehttps://github.com/nodejs/node/commit/656cfaeb2d54000aa6e9b0abd6e469f0fe217d2d
fs: add windowsHandle option to file streamshttps://github.com/nodejs/node/commit/212fe77e76969b25d902cfe7de363587f6c1fbab
212fe77https://github.com/nodejs/node/commit/212fe77e76969b25d902cfe7de363587f6c1fbab
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/57288
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/57288
libuvIssues and PRs related to the libuv dependency or the uv binding.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22libuv%22
streamIssues and PRs related to Node.js streams.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stream%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.