Skip to content

Commit

Permalink
feat: use spawn instead of fork
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed May 14, 2024
1 parent fbb525f commit 50f794d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ const debug = makeDebug('@oclif/plugin-plugins:fork')
export async function fork(modulePath: string, args: string[] = [], {cwd, logLevel}: ExecOptions): Promise<Output> {
return new Promise((resolve, reject) => {
// On windows, the global path to npm could be .cmd, .exe, or .js. If it's a .js file, we need to run it with node.
if (modulePath.endsWith('.js')) {
if (process.platform === 'win32' && modulePath.endsWith('.js')) {
args.unshift(`"${modulePath}"`)
modulePath = 'node'
}

debug('modulePath', modulePath)
debug('args', args)
const forked = spawn(modulePath, args, {
cwd,
env: {
Expand Down

0 comments on commit 50f794d

Please sign in to comment.