@@ -88,6 +88,14 @@ export type OverrideConfig = {
8888
8989export type BuildOptions = Partial < BuildOptionsDefaulted > ;
9090
91+ async function whichWrapped ( cmd : string ) : Promise < string | null > {
92+ try {
93+ return await which ( cmd ) ;
94+ } catch ( err ) {
95+ return null ;
96+ }
97+ }
98+
9199export async function defaultBuildOptions ( configs : BuildOptions , nativeonly : boolean , osonly : boolean ) : Promise < BuildOptionsDefaulted > {
92100
93101 // Handle missing configs.configurations
@@ -141,7 +149,7 @@ export async function defaultBuildOptions(configs: BuildOptions, nativeonly: boo
141149 /* eslint-disable require-atomic-updates */
142150
143151 if ( configs . cmakeToUse === undefined ) {
144- const cmake = await which ( 'cmake' ) ;
152+ const cmake = await whichWrapped ( 'cmake' ) ;
145153 if ( ! cmake ) {
146154 console . error ( 'cmake binary not found, try to specify \'cmakeToUse\'' ) ;
147155 process . exit ( 1 ) ;
@@ -150,10 +158,10 @@ export async function defaultBuildOptions(configs: BuildOptions, nativeonly: boo
150158 }
151159
152160 // handle missing generator
153- const ninjaP = which ( 'ninja' ) ;
154- const makeP = which ( 'make' ) ;
155- let ninja : string | undefined ;
156- let make : string | undefined ;
161+ const ninjaP = whichWrapped ( 'ninja' ) ;
162+ const makeP = whichWrapped ( 'make' ) ;
163+ let ninja : string | null ;
164+ let make : string | null ;
157165 if ( configs . generatorToUse === undefined ) {
158166 console . log ( 'no generator specified, checking ninja' ) ;
159167 ninja = await ninjaP ;
0 commit comments