Updates
This commit is contained in:
Vendored
+2
-1
@@ -1,6 +1,7 @@
|
||||
import { ChildProcess } from "child_process";
|
||||
/**
|
||||
* ## Kill Child Process Function
|
||||
* @param {string | number | (string | number)[]} [port]
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
export default function killChild(port?: string | number | (string | number)[]): Promise<boolean>;
|
||||
export default function killChild(childProcess?: ChildProcess, port?: string | number | (string | number)[]): Promise<boolean>;
|
||||
|
||||
Vendored
+1
-2
@@ -15,13 +15,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = killChild;
|
||||
const console_colors_1 = __importDefault(require("./console-colors"));
|
||||
const kill_port_1 = __importDefault(require("kill-port"));
|
||||
let childProcess = null;
|
||||
/**
|
||||
* ## Kill Child Process Function
|
||||
* @param {string | number | (string | number)[]} [port]
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
function killChild(port) {
|
||||
function killChild(childProcess, port) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!childProcess)
|
||||
return false;
|
||||
|
||||
Vendored
+2
-2
@@ -23,12 +23,12 @@ function run(command) {
|
||||
if (!firstCommand) {
|
||||
throw new Error("No Starting Command Found in command string!");
|
||||
}
|
||||
let childProcess = (0, child_process_1.spawn)(firstCommand, startCommandArray, {
|
||||
let newChildProcess = (0, child_process_1.spawn)(firstCommand, startCommandArray, {
|
||||
stdio: "inherit",
|
||||
killSignal: KILL_SIGNAL,
|
||||
});
|
||||
redeployments++;
|
||||
return childProcess;
|
||||
return newChildProcess;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} running start command => ${error.message}`);
|
||||
|
||||
Vendored
+1
-1
@@ -54,7 +54,7 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
||||
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Preflight Failed.`);
|
||||
}
|
||||
else {
|
||||
(0, kill_child_1.default)(port).then((kill) => {
|
||||
(0, kill_child_1.default)(childProcess, port).then((kill) => {
|
||||
if (kill) {
|
||||
childProcess = (0, run_1.default)(command);
|
||||
if (postflight) {
|
||||
|
||||
Reference in New Issue
Block a user