Skip to content

Commit

Permalink
fix(zero-cache): windows friendly fork and import calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Dec 23, 2024
1 parent 8c0492c commit b5dd861
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
56 changes: 26 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/zero-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@types/lodash.kebabcase": "^4.1.9",
"@types/lodash.merge": "^4.6.9",
"@types/lodash.snakecase": "^4.1.9",
"@types/node": "^18.16.0",
"@types/node": "^20.8.4",
"@types/pg": "^8.11.2",
"@types/pg-format": "^1.0.5",
"@types/strip-ansi": "^3.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/zero-cache/src/types/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ export function childWorker(
const ext = path.extname(import.meta.url);
// modulePath is .ts. If we have been compiled, it should be changed to .js
modulePath = modulePath.replace(/\.ts$/, ext);
const absModulePath = new URL(`../${modulePath}`, import.meta.url).pathname;
const moduleUrl = new URL(`../${modulePath}`, import.meta.url);

args.push(...process.argv.slice(2));

if (singleProcessMode()) {
const [parent, child] = inProcChannel();
import(absModulePath)
import(moduleUrl.href)
.then(({default: runWorker}) =>
runWorker(parent, env ?? process.env, ...args).then(
() => child.emit('close', 0),
Expand All @@ -176,7 +176,7 @@ export function childWorker(
return child;
}
return wrap(
fork(absModulePath, args, {
fork(moduleUrl, args, {
detached: true, // do not automatically propagate SIGINT
serialization: 'advanced', // use structured clone for IPC
env,
Expand Down

0 comments on commit b5dd861

Please sign in to comment.