Switch to double quotes and reformat codebase with Biome

This commit is contained in:
Mohamed Boudra
2026-03-21 20:22:15 +07:00
parent ab40786882
commit f6579dbeb4
805 changed files with 38132 additions and 40175 deletions
@@ -1,46 +1,45 @@
import { spawnSync } from 'node:child_process'
import { spawnSync } from "node:child_process";
export interface NodePathFromPidResult {
nodePath: string | null
error?: string
nodePath: string | null;
error?: string;
}
function normalizeError(error: unknown): string {
if (error instanceof Error) {
return error.message
return error.message;
}
return String(error)
return String(error);
}
export function resolveNodePathFromPid(pid: number): NodePathFromPidResult {
const result = spawnSync('ps', ['-o', 'comm=', '-p', String(pid)], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'pipe'],
})
const result = spawnSync("ps", ["-o", "comm=", "-p", String(pid)], {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
});
if (result.error) {
return {
nodePath: null,
error: `ps failed: ${normalizeError(result.error)}`,
}
};
}
if ((result.status ?? 1) !== 0) {
const details = result.stderr?.trim()
const details = result.stderr?.trim();
return {
nodePath: null,
error: details ? `ps failed: ${details}` : `ps exited with code ${result.status ?? 1}`,
}
};
}
const resolved = result.stdout.trim()
const resolved = result.stdout.trim();
if (!resolved) {
return {
nodePath: null,
error: 'ps returned an empty command path',
}
error: "ps returned an empty command path",
};
}
return { nodePath: resolved }
return { nodePath: resolved };
}