From 66a3180ec31bca52bb6ee83b09324c823b7291a4 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Wed, 15 May 2024 21:34:15 +0000 Subject: [PATCH] backport of commit 60d46ec14643a93c9850eca3f862151cc6828772 --- packer_test/commands_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packer_test/commands_test.go b/packer_test/commands_test.go index a49f289d8..8f6beb7e5 100644 --- a/packer_test/commands_test.go +++ b/packer_test/commands_test.go @@ -2,6 +2,7 @@ package packer_test import ( "fmt" + "os" "os/exec" "strings" "sync" @@ -29,6 +30,16 @@ func (ts *PackerTestSuite) PackerCommand() *packerCommand { packerPath: ts.packerPath, env: map[string]string{ "PACKER_LOG": "1", + // Required for Windows, otherwise since we overwrite all + // the envvars for the test and Go relies on that envvar + // being set in order to return another path than + // C:\Windows by default + // + // If we don't have it, Packer immediately errors upon + // invocation as the temporary logfile that we write in + // case of Panic will fail to be created (unless tests + // are running as Administrator, but please don't). + "TMP": os.TempDir(), }, stderr: stderr, stdout: stdout,