fix: Update pipe path handling for cross-platform compatibility in ChildWorker and PipeName
This commit is contained in:
@@ -206,9 +206,12 @@ function sleep(ms, signal) {
|
|||||||
// Main
|
// Main
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
// .NET uses different pipe paths per platform:
|
||||||
|
// - Windows: \\.\pipe\{pipeName}
|
||||||
|
// - Unix/macOS: /tmp/CoreFxPipe_{pipeName}
|
||||||
const pipePath = process.platform === 'win32'
|
const pipePath = process.platform === 'win32'
|
||||||
? `\\\\.\\pipe\\${pipeName}`
|
? `\\\\.\\pipe\\${pipeName}`
|
||||||
: `/tmp/${pipeName}`;
|
: `/tmp/CoreFxPipe_${pipeName}`;
|
||||||
|
|
||||||
const socket = net.createConnection(pipePath, () => {
|
const socket = net.createConnection(pipePath, () => {
|
||||||
// Connection established - send hello
|
// Connection established - send hello
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace CommIpc;
|
namespace CommIpc;
|
||||||
|
|
||||||
@@ -14,7 +15,10 @@ public static class PipeName
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helpful for logs / debugging.
|
/// Returns the full pipe path for the current platform.
|
||||||
|
/// Windows: \\.\pipe\{pipeName}
|
||||||
|
/// Unix/macOS: /tmp/CoreFxPipe_{pipeName}
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string Describe(string pipeName) => $"\\\\.\\pipe\\{pipeName}";
|
public static string Describe(string pipeName) =>
|
||||||
|
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"\\\\.\\pipe\\{pipeName}" : $"/tmp/CoreFxPipe_{pipeName}";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user