Bugfix: fix race conditions

This commit is contained in:
2026-08-10 11:07:39 +01:00
parent 44c5c19050
commit 9eae95e391
14 changed files with 326 additions and 175 deletions
-19
View File
@@ -1,4 +1,3 @@
import { spawn } from "child_process";
import watchFiles from "./watch/files";
import watchFolders from "./watch/folders";
import { TurboSyncConfigObject } from "../types";
@@ -9,11 +8,7 @@ import fldFileToStrArr, {
const confFileProvidedJSON = process.argv[process.argv.length - 1];
global.SYNC_SUCCESS_EXIT_CODE = 32;
global.CONFIG_DIR = process.cwd();
global.SYNCING = false;
const REWATCH_TIMEOUT = 1000;
try {
const configFileObject: TurboSyncConfigObject =
@@ -70,17 +65,3 @@ try {
console.log(error);
process.exit();
}
process.on("exit", (code) => {
if (code == global.SYNC_SUCCESS_EXIT_CODE) {
const args = process.argv;
const cmd = args.shift();
if (cmd) {
spawn(cmd, args, {
stdio: "inherit",
});
}
} else {
process.exit(0);
}
});