Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relative paths on Windows #390

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/master/implementation.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import getCallsites, { CallSite } from "callsites"
import { EventEmitter } from "events"
import { cpus } from 'os'
import * as path from "path"
import { fileURLToPath } from "url";
andywer marked this conversation as resolved.
Show resolved Hide resolved
import {
ImplementationExport,
ThreadsWorkerOptions,
Expand Down Expand Up @@ -69,7 +70,10 @@ function rebaseScriptPath(scriptPath: string, ignoreRegex: RegExp) {
})

const rawCallerPath = parentCallSite ? parentCallSite.getFileName() : null
const callerPath = rawCallerPath ? rawCallerPath.replace(/^file:\//, "") : null
let callerPath = rawCallerPath ? rawCallerPath : null;
if (callerPath && callerPath.startsWith('file:')) {
callerPath = fileURLToPath(callerPath);
}
const rebasedScriptPath = callerPath ? path.join(path.dirname(callerPath), scriptPath) : scriptPath

return rebasedScriptPath
Expand Down