refactor(daemon): share runtime and service probe helpers

This commit is contained in:
Peter Steinberger
2026-02-22 21:18:30 +00:00
parent e029f78447
commit 06b0a60bef
12 changed files with 241 additions and 107 deletions

View File

@@ -1,5 +1,6 @@
import fs from "node:fs/promises";
import path from "node:path";
import { isBunRuntime, isNodeRuntime } from "./runtime-binary.js";
type GatewayProgramArgs = {
programArguments: string[];
@@ -8,16 +9,6 @@ type GatewayProgramArgs = {
type GatewayRuntimePreference = "auto" | "node" | "bun";
function isNodeRuntime(execPath: string): boolean {
const base = path.basename(execPath).toLowerCase();
return base === "node" || base === "node.exe";
}
function isBunRuntime(execPath: string): boolean {
const base = path.basename(execPath).toLowerCase();
return base === "bun" || base === "bun.exe";
}
async function resolveCliEntrypointPathForService(): Promise<string> {
const argv1 = process.argv[1];
if (!argv1) {