From 16ac692037b11b9d40f15f57caf99632ada75ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20B=C3=B6rchers?= Date: Tue, 24 Feb 2026 20:39:01 +0100 Subject: [PATCH] fix: Update pipe path handling for cross-platform compatibility in ChildWorker and PipeName --- ChildWorkerNode/child-worker.js | 5 ++++- CommIpc/PipeName.cs | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChildWorkerNode/child-worker.js b/ChildWorkerNode/child-worker.js index e65bf66..4164e58 100644 --- a/ChildWorkerNode/child-worker.js +++ b/ChildWorkerNode/child-worker.js @@ -206,9 +206,12 @@ function sleep(ms, signal) { // Main // ───────────────────────────────────────────────────────────────────────────── +// .NET uses different pipe paths per platform: +// - Windows: \\.\pipe\{pipeName} +// - Unix/macOS: /tmp/CoreFxPipe_{pipeName} const pipePath = process.platform === 'win32' ? `\\\\.\\pipe\\${pipeName}` - : `/tmp/${pipeName}`; + : `/tmp/CoreFxPipe_${pipeName}`; const socket = net.createConnection(pipePath, () => { // Connection established - send hello diff --git a/CommIpc/PipeName.cs b/CommIpc/PipeName.cs index 5a93fd3..b67a7b4 100644 --- a/CommIpc/PipeName.cs +++ b/CommIpc/PipeName.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Runtime.InteropServices; namespace CommIpc; @@ -14,7 +15,10 @@ public static class PipeName } /// - /// Helpful for logs / debugging. + /// Returns the full pipe path for the current platform. + /// Windows: \\.\pipe\{pipeName} + /// Unix/macOS: /tmp/CoreFxPipe_{pipeName} /// - public static string Describe(string pipeName) => $"\\\\.\\pipe\\{pipeName}"; + public static string Describe(string pipeName) => + RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"\\\\.\\pipe\\{pipeName}" : $"/tmp/CoreFxPipe_{pipeName}"; }