11import path from 'node:path' ;
22import fs from 'node:fs' ;
3+ import os from 'node:os' ;
34import { execSync } from 'node:child_process' ;
45
56// weird tsup issue using `typeof execSync` from node:child_process
67// see https://github.com/egoist/tsup/issues/1367
78import type { execSync as execSyncType } from 'child_process' ;
89
10+ const platform = os . platform ( ) ;
11+ const isWindows = platform . match ( / ^ w i n / i) ;
12+
13+
914/**
1015 * small helper to call execSync and call the varlock cli
1116 *
@@ -30,8 +35,9 @@ export function execSyncVarlock(
3035 } ) ;
3136 return result . toString ( ) ;
3237 } catch ( err ) {
33- // code 127 means not found
34- if ( ( err as any ) . status !== 127 ) throw err ;
38+ // code 127 means not found (on linux only)
39+ if ( ! isWindows && ( err as any ) . status !== 127 ) throw err ;
40+ // on windows, we'll just do the extra checks anyway
3541 }
3642
3743 // if varlock was not found, it either means it is not installed
@@ -47,8 +53,6 @@ export function execSyncVarlock(
4753 ...opts ,
4854 stdio : 'pipe' ,
4955 } ) ;
50- // const commandArgs = command.split(' ').filter(Boolean);
51- // const result = execFileSync(possibleVarlockPath, commandArgs, opts);
5256 return result . toString ( ) ;
5357 } else {
5458 throw new Error ( 'Unable to find varlock executable' ) ;
0 commit comments