Skip to content

Commit

Permalink
build: handle errors correctly, skip payware when running in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
YoRyan committed Jul 11, 2024
1 parent 3c6d54a commit ec0bd59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions build-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ function printDiagnostics(diagnostics: ts.Diagnostic[]) {
}

async function injectPaywareScripts(lua: string) {
if (process.env.CI === "true") return lua;

const pathMap = new Map<string, string>([
["REPPO_AEM7_ENGINESCRIPT", "./payware/Assets/Reppo/AEM7/RailVehicles/Scripts/AEM7_EngineScript.out"],
["REPPO_E60_ENGINESCRIPT", "./payware/Assets/Reppo/E60CP/RailVehicles/Scripts/E60_EngineScript.out"],
Expand Down
17 changes: 12 additions & 5 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,19 @@ class MultiProcessTranspiler implements Transpiler {
} as Job);

const startMs = nowTime();
await new Promise<void>(resolve => {
worker.on("message", resolve);
});
try {
await new Promise<void>((resolve, reject) => {
worker.on("message", resolve);
worker.on("error", reject);
worker.on("exit", reject);
});
this.returnWorker(worker);
} catch {
this.workersToSpawn++;
} finally {
worker.removeAllListeners();
}
const endMs = nowTime();

this.returnWorker(worker);
return endMs - startMs;
}
private async getWorker() {
Expand Down

0 comments on commit ec0bd59

Please sign in to comment.