File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const wrapPowershellString string = `
5555 $exitCode = 1
5656 }
5757
58- if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {
58+ if ((Test-Path variable:global:LASTEXITCODE) -and $LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {
5959 $exitCode = $LASTEXITCODE
6060 }
6161 exit $exitCode
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ func TestProvisionerPrepare_extractScript(t *testing.T) {
3636
3737 // File contents should contain 2 lines concatenated by newlines: foo\nbar
3838 readFile , err := os .ReadFile (file )
39- expectedContents := "if (Test-Path variable:global:ProgressPreference) {\n set-variable -name variable:global:ProgressPreference -value 'SilentlyContinue'\n }\n \n $exitCode = 0\n try {\n $env:PACKER_BUILDER_TYPE=\" \" ; $env:PACKER_BUILD_NAME=\" \" ; \n foo\n bar\n \n $exitCode = 0\n } catch {\n Write-Error \" An error occurred: $_\" \n $exitCode = 1\n }\n \n if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {\n $exitCode = $LASTEXITCODE\n }\n exit $exitCode"
39+ expectedContents := "if (Test-Path variable:global:ProgressPreference) {\n set-variable -name variable:global:ProgressPreference -value 'SilentlyContinue'\n }\n \n $exitCode = 0\n try {\n $env:PACKER_BUILDER_TYPE=\" \" ; $env:PACKER_BUILD_NAME=\" \" ; \n foo\n bar\n \n $exitCode = 0\n } catch {\n Write-Error \" An error occurred: $_\" \n $exitCode = 1\n }\n \n if ((Test-Path variable:global:LASTEXITCODE) -and $LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {\n $exitCode = $LASTEXITCODE\n }\n exit $exitCode"
4040 normalizedExpectedContent := normalizeWhiteSpace (expectedContents )
4141 if err != nil {
4242 t .Fatalf ("Should not be error: %s" , err )
You can’t perform that action at this time.
0 commit comments