removing $result from wrapper string (#13451)

* removing $result from wrapper

* test fixes
pull/13453/head
kp2099 6 months ago committed by GitHub
parent 40bea58c92
commit 4dd1fef558
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -58,8 +58,6 @@ const wrapPowershellString string = `
if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {
$exitCode = $LASTEXITCODE
}
Write-Host $result
exit $exitCode
`

@ -36,7 +36,7 @@ func TestProvisionerPrepare_extractScript(t *testing.T) {
// File contents should contain 2 lines concatenated by newlines: foo\nbar
readFile, err := os.ReadFile(file)
expectedContents := " \n\tif (Test-Path variable:global:ProgressPreference) {\n\t set-variable -name variable:global:ProgressPreference -value 'SilentlyContinue'\n\t}\n\t\n\t$exitCode = 0\n\ttry {\n\t$env:PACKER_BUILDER_TYPE=\"\"; $env:PACKER_BUILD_NAME=\"\"; \n\tfoo\n\tbar\n\t\n\t$exitCode = 0\n\t} catch {\n\tWrite-Error \"An error occurred: $_\"\n\t$exitCode = 1\n\t}\n\t\n\tif ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {\n\t\t$exitCode = $LASTEXITCODE\n\t}\n\t\n\tWrite-Host $result\n\texit $exitCode\n\n"
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"
normalizedExpectedContent := normalizeWhiteSpace(expectedContents)
if err != nil {
t.Fatalf("Should not be error: %s", err)

Loading…
Cancel
Save