This commit is contained in:
Benjamin Toby
2025-01-16 09:28:46 +01:00
parent 2cd83295bf
commit 1c26586478
11 changed files with 13 additions and 16 deletions
+1 -2
View File
@@ -2,14 +2,13 @@ import { ChildProcess } from "child_process";
import colors from "./console-colors";
import kill from "kill-port";
let childProcess: ChildProcess | null = null;
/**
* ## Kill Child Process Function
* @param {string | number | (string | number)[]} [port]
* @returns {Promise<boolean>}
*/
export default async function killChild(
childProcess?: ChildProcess,
port?: string | number | (string | number)[]
): Promise<boolean> {
if (!childProcess) return false;
+2 -2
View File
@@ -26,14 +26,14 @@ export default function run(command: string): ChildProcess | null {
throw new Error("No Starting Command Found in command string!");
}
let childProcess = spawn(firstCommand, startCommandArray, {
let newChildProcess = spawn(firstCommand, startCommandArray, {
stdio: "inherit",
killSignal: KILL_SIGNAL,
});
redeployments++;
return childProcess;
return newChildProcess;
} catch (error: any) {
console.log(
`${colors.FgRed}Error:${colors.Reset} running start command => ${error.message}`
+1 -1
View File
@@ -83,7 +83,7 @@ export default function startProcess({
`${colors.FgRed}Error:${colors.Reset} Preflight Failed.`
);
} else {
killChild(port).then((kill) => {
killChild(childProcess, port).then((kill) => {
if (kill) {
childProcess = run(command);