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
View File
@@ -14,7 +14,6 @@ function run() {
const configText = fs_1.default.readFileSync(path_1.default.join(WORK_DIR, "buncid.config.json"), "utf-8");
const config = JSON.parse(configText);
const { start, preflight, postflight, build, redeploy_path, first_run, port, } = config;
/** @type {string | undefined} */
let redeployFile;
if (!redeploy_path) {
const defaultRedeployPath = path_1.default.join(WORK_DIR, "REDEPLOY");
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -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>;
+1 -2
View File
@@ -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;
+2 -2
View File
@@ -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}`);
+1 -1
View File
@@ -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) {