From 808396c4e66af5685c1168b56c57c63007e8cad0 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 22 Feb 2022 04:43:32 +0530 Subject: [PATCH] Fix Add-EnvPATH on self-hosted Windows --- src/scripts/win32.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 8ec36654..41457399 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -118,11 +118,13 @@ Function Add-EnvPATH { if(-not(Test-Path $EnvPATH)) { return } - $env_file = $current_profile - if ($env:GITHUB_ENV) { - $env_file = $env:GITHUB_ENV + $env_file = $env:GITHUB_ENV + $env_data = Get-Content -Path $EnvPATH + if (-not($env:GITHUB_ENV)) { + $env_file = $current_profile + $env_data = $env_data | ForEach-Object { '$env:' + $_ } } - Get-Content -Path $EnvPATH | Add-Content -Path $env_file -Encoding utf8 + $env_data | Add-Content -Path $env_file -Encoding utf8 } # Function to make sure printf is in PATH.