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
This commit is contained in:
Jordan Tucker
2024-08-05 11:37:17 -05:00
committed by GitHub
parent 6271ee4d07
commit 47c2a6eebf

View File

@@ -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`;