From 47c2a6eebfc2f9534779d08d6f8d78ecc595abe8 Mon Sep 17 00:00:00 2001 From: Jordan Tucker Date: Mon, 5 Aug 2024 11:37:17 -0500 Subject: [PATCH] Use PowerShell to set PATH instead of setx on Windows (#13254) * fix(installer): use powershell to set PATH instead of setx * style: run prettier * style(installer): fix comma --- npm-packages/meteor-installer/install.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/npm-packages/meteor-installer/install.js b/npm-packages/meteor-installer/install.js index 1598e0b893..9f98f0e8d5 100644 --- a/npm-packages/meteor-installer/install.js +++ b/npm-packages/meteor-installer/install.js @@ -302,7 +302,9 @@ async function setup() { async function setupExecPath() { if (isWindows()) { // set for the current session and beyond - child_process.execSync(`setx path "${meteorPath}/;%path%`); + child_process.execSync( + `powershell -c "$path = (Get-Item 'HKCU:\\Environment').GetValue('Path', '', 'DoNotExpandEnvironmentNames'); [Environment]::SetEnvironmentVariable('PATH', \\"${meteorPath};$path\\", 'User');"`, + ); return; } const exportCommand = `export PATH=${meteorPath}:$PATH`;