From 0c440c82caac7f57c9fc09c5e6e036222b394afd Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Mon, 5 Apr 2021 17:09:48 +0300 Subject: [PATCH] [ubuntu] Fix packer output for version 1.7.1 (#3098) --- .../linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 9c333259d..deab9dcd7 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -157,7 +157,10 @@ function Get-NvmVersion { } function Get-PackerVersion { - return "Packer $(packer --version)" + # Packer 1.7.1 has a bug and outputs version to stderr instead of stdout https://github.com/hashicorp/packer/issues/10855 + $result = (Get-CommandResult -Command "packer --version").Output + $packerVersion = [regex]::matches($result, "(\d+.){2}\d+").Value + return "Packer $packerVersion" } function Get-PhantomJSVersion {