From eda5443bda7512c3499438b4850f9a9988ec2e12 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Mon, 25 Mar 2024 16:58:06 -0700 Subject: [PATCH] Ensure script can launch, override path values on logging, add reboot warning --- packages/settings-view/lib/system-windows-panel.js | 2 +- resources/win/modifyWindowsPath.ps1 | 4 ++-- src/main-process/win-shell.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/settings-view/lib/system-windows-panel.js b/packages/settings-view/lib/system-windows-panel.js index 6ba1e1123..efe42a98a 100644 --- a/packages/settings-view/lib/system-windows-panel.js +++ b/packages/settings-view/lib/system-windows-panel.js @@ -129,7 +129,7 @@ export default class SystemPanel { }} />
Add Pulsar to PATH
- Add Pulsar to Windows PATH to enable CLI usage. + Add Pulsar to Windows PATH to enable CLI usage. (May require a reboot to take effect.)
diff --git a/resources/win/modifyWindowsPath.ps1 b/resources/win/modifyWindowsPath.ps1 index ab7c5cd66..71b928c93 100644 --- a/resources/win/modifyWindowsPath.ps1 +++ b/resources/win/modifyWindowsPath.ps1 @@ -25,7 +25,7 @@ if (-not $remove) { # We want to add Pulsar path values # Lets first save a copy of the users current path - $env:Path >> prior2addition.txt; + $env:Path > prior2addition.txt; $originalPathToInstall = $installdir @@ -67,7 +67,7 @@ if (-not $remove) { # We want to remove Pulsar from the user path # Lets first save a copy of the users current path - $env:Path >> prior2removal.txt; + $env:Path > prior2removal.txt; $pulsarPath = $installdir + "\resources"; $ppmPath = $installdir + "\resources\app\ppm\bin"; diff --git a/src/main-process/win-shell.js b/src/main-process/win-shell.js index 40831c27c..e96c5a3d3 100644 --- a/src/main-process/win-shell.js +++ b/src/main-process/win-shell.js @@ -118,13 +118,13 @@ class PathOption { register(callback) { this.getPulsarPath().then((pulsarPath) => { const child = ChildProcess.execFile( - `"${pulsarPath}\\resources\\modifyWindowsPath.ps1"`, - ['-installdir', `"${pulsarPath}"`, '-remove', '0'], + `powershell.exe '${pulsarPath}\\resources\\modifyWindowsPath.ps1'`, + ['-installdir', `'${pulsarPath}'`, '-remove', '0'], { shell: "powershell.exe" }, (error, stdout, stderr) => { if (error) { - atom.notifications.addError(`Error Running Script: ${error.toString()}`); + atom.notifications.addError(`Error Running Script: ${error.toString()}`, { dismissable: true }); callback(error); } else { return callback(); @@ -140,13 +140,13 @@ class PathOption { if (isRegistered) { this.getPulsarPath().then((pulsarPath) => { const child = ChildProcess.execFile( - `"${pulsarPath}\\resources\\modifyWindowsPath.ps1"`, + `powershell.exe "${pulsarPath}\\resources\\modifyWindowsPath.ps1"`, ['-installdir', `"${pulsarPath}"`, '-remove', '1'], { shell: "powershell.exe" }, (error, stdout, stderr) => { if (error) { - atom.notifications.addError(`Error Running Script: ${error.toString()}`); + atom.notifications.addError(`Error Running Script: ${error.toString()}`, { dismissable: true }); callback(error); } else { return callback();