Skip to content

Commit

Permalink
fix: worker path
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <[email protected]>
  • Loading branch information
dselman committed Apr 24, 2024
1 parent 5873700 commit d6f9548
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/JavaScriptEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class JavaScriptEvaluator {
} catch(err) {
// if we cannot load the module it likely means we are running
// a unit test inside the module...
return './dist/worker.js';
return path.join(__dirname, '..', 'dist', 'worker.js');
}
}
private doWork(work: WorkItem, options: EvalOptions): Promise<EvalResponse> {
Expand All @@ -168,7 +168,9 @@ export class JavaScriptEvaluator {
reject({ message: 'Cannot use evalChildProcess because child_process.fork is not defined.' });
}
// on timeout will send SIGTERM
const worker = child_process.fork(this.getWorkerPath(), { timeout: options.timeout, env: {} });
const workerPath = this.getWorkerPath();
// console.debug(`Worker path: ${workerPath}`);
const worker = child_process.fork(workerPath, { timeout: options.timeout, env: {} });
if (!worker.pid) {
throw new Error('Failed to fork child process');
}
Expand Down

0 comments on commit d6f9548

Please sign in to comment.