@@ -27,16 +27,20 @@ async function checkInstalled (name) {
27
27
return tools [ name ] . installed
28
28
}
29
29
30
- async function checkCommands ( commands , args ) {
30
+ async function findCommand ( commands , args ) {
31
31
for ( const command of commands ) {
32
32
try {
33
33
await execFile ( command , args )
34
34
} catch ( error ) {
35
35
continue
36
36
}
37
- return true
37
+ return command
38
38
}
39
- return false
39
+ return null
40
+ }
41
+
42
+ async function checkCommands ( commands , args ) {
43
+ return ( await findCommand ( commands , args ) ) !== null
40
44
}
41
45
42
46
let mipsInstalling = false
@@ -306,7 +310,7 @@ async function installCMake () {
306
310
asset . browser_download_url . split ( '/' ) . pop ( )
307
311
)
308
312
await downloader . downloadFile ( asset . browser_download_url , filename )
309
- await execFile ( 'start ' , [ filename ] )
313
+ await execFile ( 'msiexec ' , [ '/i' , filename ] )
310
314
requiresReboot = true
311
315
break
312
316
case 'linux' :
@@ -457,7 +461,7 @@ async function installPython () {
457
461
}
458
462
}
459
463
460
- async function checkPython ( ) {
464
+ async function findPython ( ) {
461
465
switch ( process . platform ) {
462
466
case 'win32' :
463
467
/*
@@ -501,12 +505,12 @@ async function checkPython () {
501
505
} catch ( error ) {
502
506
continue
503
507
}
504
- return true
508
+ return fullPath
505
509
}
506
510
}
507
- return false
511
+ return null
508
512
default :
509
- return checkCommands ( [ 'python3' , 'python' ] , [ '--version' ] )
513
+ return await findCommand ( [ 'python3' , 'python' ] , [ '--version' ] )
510
514
}
511
515
}
512
516
@@ -606,7 +610,7 @@ const tools = {
606
610
'Python language runtime, required to run some project templates\' scripts' ,
607
611
homepage : 'https://python.org/' ,
608
612
install : installPython ,
609
- check : checkPython
613
+ check : async ( ) => ( await findPython ( ) ) !== null
610
614
} ,
611
615
clangd : {
612
616
type : 'extension' ,
@@ -702,6 +706,8 @@ exports.setGlobalStorageUri = (uri) => {
702
706
globalStorageUri = uri
703
707
}
704
708
709
+ exports . findPython = findPython
710
+
705
711
exports . install = async ( toInstall , force ) => {
706
712
if ( requiresReboot ) {
707
713
return true
0 commit comments