Bugfix: fix race conditions
This commit is contained in:
-19
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user