Skip to content
Open
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
17 changes: 13 additions & 4 deletions src/wrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ if (cfg.fork) {
// too. We also need to relay messages about required files to the parent.
const newFork = function (
modulePath: string,
args: string[],
options: ForkOptions
) {
const child = oldFork(__filename, [modulePath].concat(args), options)
args?: string[] | ForkOptions,
options?: ForkOptions
) {

let forkArgs: string[];
if (args instanceof Array) {
forkArgs = [modulePath].concat(args);
} else {
forkArgs = [modulePath];
options = args;
}

const child = oldFork(__filename, forkArgs, options)
ipc.relay(child)
return child
}
Expand Down