Reload Env:PATH to get changes from inspec installation

Reloading Env:PATH does a better job of testing if
the installation properly configured the system's
PATH.

Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
This commit is contained in:
Jeremiah Snapp 2019-04-12 03:53:16 -04:00
parent 5de39cb325
commit 8533998fb8

View file

@ -29,13 +29,15 @@ Start-Process "$package_file" /quiet -Wait
Write-Output "--- Testing $channel $product $version"
$Env:PATH = "C:\opscode\inspec\bin;${Env:PATH}"
Write-Output "Running verification for $product"
# reload Env:PATH to ensure it gets any changes that the install made (e.g. C:\opscode\inspec\bin\ )
$Env:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
# Set GEM_HOME and GEM_PATH to verify our appbundle inspec shim is correctly
# removing them from the environment while launching from our embedded ruby.
$Env:GEM_HOME = "C:\SHOULD_NOT_EXIST"
$Env:GEM_PATH = "C:\SHOULD_NOT_EXIST"
inspec version
If ($lastexitcode -ne 0) { Exit $lastexitcode }