Can't use receive-job withing jobs

This commit is contained in:
Gator96100 2020-10-05 22:06:03 +02:00
parent 4003f47b6e
commit bf70999c4e

View file

@ -53,7 +53,9 @@ clone_script:
Write-Host "[ OK ]" -ForegroundColor Green
}
$env:WSLInstalljob = Start-Job -Name WSLInstall -ScriptBlock {
$env:wsl_install_running = true
$WSLjob = Start-Job -Name WSLInstall -ScriptBlock {
Function WSLExec($Text, $Cmd) {
Write-Host "$Text"
wsl -- bash -c $Cmd
@ -68,6 +70,7 @@ clone_script:
WSLExec "WSL install..." "sudo apt-get -y install --reinstall --no-install-recommends git ca-certificates build-essential pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev qtbase5-dev cmake 1>/dev/null"
WSLExec "WSL QT fix..." "sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5"
Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 1000) sec" -Category Information
$env:wsl_install_running = false
}
$env:PSInstallTime=[System.Environment]::TickCount
@ -154,7 +157,7 @@ install:
}
Start-Sleep -s 5
Receive-Job -Job $env:WSLInstalljob -ErrorAction SilentlyContinue
Receive-Job -Name WSLInstall -ErrorAction SilentlyContinue
}
#Receive-Job -Wait -Name PSInstall
}
@ -235,7 +238,13 @@ build_script:
}
#WSL: wait for installation to finish
Receive-Job -Job $env:WSLInstalljob -ErrorAction SilentlyContinue
if($env:wsl_install_running){
Write-Host "Waiting for WSL installation to finish..."
while($env:wsl_install_running) {
Start-Sleep -s 1
}
Write-Host "$Name [ OK ]" -ForegroundColor Green
}
#Windows Subsystem for Linux (WSL)
Write-Host "---------- WSL make ----------" -ForegroundColor Yellow
@ -321,6 +330,8 @@ build_script:
ExecCheck "PS cmake Tests"
Receive-Job -Wait -Name WSLInstall -ErrorAction SilentlyContinue
Receive-Job -Wait -Job $WSLjob