@@ -8,6 +8,7 @@ import { HOME } from '#env/home'
88import { LOCALAPPDATA } from '#env/localappdata'
99import { XDG_DATA_HOME } from '#env/xdg-data-home'
1010
11+ import { WIN32 } from '#constants/platform'
1112import { readJsonSync } from './fs'
1213import { getOwn } from './objects'
1314import { isPath , normalizePath } from './path'
@@ -79,7 +80,11 @@ export async function execBin(
7980 const binCommand = Array . isArray ( resolvedPath )
8081 ? resolvedPath [ 0 ] !
8182 : resolvedPath
82- return await spawn ( binCommand , args ?? [ ] , options )
83+ // On Windows, binaries are often .cmd files that require shell to execute.
84+ return await spawn ( binCommand , args ?? [ ] , {
85+ shell : WIN32 ,
86+ ...options ,
87+ } )
8388}
8489
8590/**
@@ -248,7 +253,6 @@ export function findRealNpm(): string {
248253 * Find the real pnpm executable, bypassing any aliases and shadow bins.
249254 */
250255export function findRealPnpm ( ) : string {
251- const WIN32 = require ( '../constants/platform' ) . WIN32
252256 const path = getPath ( )
253257
254258 // Try common pnpm locations.
@@ -381,7 +385,6 @@ export function resolveBinPathSync(binPath: string): string {
381385 return voltaBinPath
382386 }
383387 }
384- const WIN32 = require ( '../constants/platform' ) . WIN32
385388 if ( WIN32 ) {
386389 const hasKnownExt =
387390 extLowered === '' ||
0 commit comments