@@ -91,9 +91,9 @@ export async function setupZephyr(
9191 return ;
9292 }
9393
94- let output : ZephyrSetupOutputs = { cmakeExecutable : "" } ;
94+ const output : ZephyrSetupOutputs = { cmakeExecutable : "" } ;
9595
96- let python3Path = "" ;
96+ let python3Path : string | undefined = "" ;
9797 let isWindows = false ;
9898 await window . withProgress (
9999 {
@@ -524,7 +524,7 @@ export async function setupZephyr(
524524 }
525525 ) ;
526526
527- const pythonExe = python3Path . replace (
527+ const pythonExe = python3Path ? .replace (
528528 HOME_VAR ,
529529 homedir ( ) . replaceAll ( "\\" , "/" )
530530 ) ;
@@ -827,46 +827,49 @@ export async function setupZephyr(
827827 title : "Installing Zephyr SDK" ,
828828 cancellable : false ,
829829 } ,
830- async progress2 => {
831- const westInstallSDKCommand : string = [
832- westExe ,
833- "sdk install -t arm-zephyr-eabi" ,
834- `-b ${ zephyrWorkspaceDirectory } ` ,
835- ] . join ( " " ) ;
830+ async progress2 =>
831+ new Promise < void > ( resolve => {
832+ const westInstallSDKCommand : string = [
833+ westExe ,
834+ "sdk install -t arm-zephyr-eabi" ,
835+ `-b ${ zephyrWorkspaceDirectory } ` ,
836+ ] . join ( " " ) ;
837+
838+ // This has to be a spawn due to the way the underlying SDK command calls
839+ // subprocess and needs to inherit the Path variables set in customEnv
840+ _logger . info ( "Installing Zephyr SDK" ) ;
841+ const child = spawnSync ( westInstallSDKCommand , {
842+ shell : true ,
843+ cwd : zephyrWorkspaceDirectory ,
844+ windowsHide : true ,
845+ env : customEnv ,
846+ } ) ;
847+ _logger . info ( "stdout: " , child . stdout . toString ( ) ) ;
848+ _logger . info ( "stderr: " , child . stderr . toString ( ) ) ;
849+ if ( child . status ) {
850+ _logger . info ( "exit code: " , child . status ) ;
851+ if ( child . status !== 0 ) {
852+ window . showErrorMessage (
853+ "Error installing Zephyr SDK." + "Exiting Zephyr Setup."
854+ ) ;
855+ }
836856
837- // This has to be a spawn due to the way the underlying SDK command calls
838- // subprocess and needs to inherit the Path variables set in customEnv
839- _logger . info ( "Installing Zephyr SDK" ) ;
840- const child = spawnSync ( westInstallSDKCommand , {
841- shell : true ,
842- cwd : zephyrWorkspaceDirectory ,
843- windowsHide : true ,
844- env : customEnv ,
845- } ) ;
846- _logger . info ( "stdout: " , child . stdout . toString ( ) ) ;
847- _logger . info ( "stderr: " , child . stderr . toString ( ) ) ;
848- if ( child . status ) {
849- _logger . info ( "exit code: " , child . status ) ;
850- if ( child . status !== 0 ) {
851- window . showErrorMessage (
852- "Error installing Zephyr SDK." + "Exiting Zephyr Setup."
853- ) ;
857+ installedSuccessfully = false ;
858+ progress2 . report ( {
859+ message : "Failed" ,
860+ increment : 100 ,
861+ } ) ;
862+ resolve ( ) ;
863+
864+ return ;
854865 }
855866
856- installedSuccessfully = false ;
857867 progress2 . report ( {
858- message : "Failed " ,
868+ message : "Successfully installed Zephyr SDK. " ,
859869 increment : 100 ,
860870 } ) ;
861-
862- return ;
863- }
864-
865- progress2 . report ( {
866- message : "Successfully installed Zephyr SDK." ,
867- increment : 100 ,
868- } ) ;
869- }
871+ resolve ( ) ;
872+ } )
870873 ) ;
871874
872875 if ( installedSuccessfully ) {
0 commit comments