Updates
This commit is contained in:
+1
-2
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user