Skip to content

Commit 72bbef3

Browse files
committed
Automatically close the target editor when updating via script arguments
- after updating, should close the updated editor
1 parent 9b8edcd commit 72bbef3

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎install.ps1‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ function Install-ToEditor($idx) {
184184
$ErrorActionPreference = "Stop"
185185

186186
if ($targetScheme) {
187+
$processName = switch ($editorCmd) {
188+
"code" { "Code" }
189+
"code-insiders" { "Code - Insiders" }
190+
"codium" { "VSCodium" }
191+
"cursor" { "Cursor" }
192+
"agy-ide" { "Antigravity" }
193+
default { $editorCmd }
194+
}
195+
Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process -Force
187196
Write-Host "Updated successfully! Restart extensions for changes to take effect."
188197
} else {
189198
Write-Host "Successfully installed to $editorName!"

‎install.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ install_to_editor() {
195195
$editor_cmd --install-extension "$VSIX_FILE" --force > /dev/null 2>&1
196196

197197
if [ -n "$TARGET_SCHEME" ]; then
198+
case "$editor_cmd" in
199+
"code") pkill -f "Visual Studio Code" || pkill -x code || killall code ;;
200+
"code-insiders") pkill -f "Visual Studio Code - Insiders" || pkill -x code-insiders || killall code-insiders ;;
201+
"codium") pkill -f "VSCodium" || pkill -x codium || killall codium ;;
202+
"cursor") pkill -f "Cursor" || pkill -x cursor || killall cursor ;;
203+
"agy-ide") pkill -f "Antigravity" || pkill -x agy-ide || killall agy-ide ;;
204+
esac >/dev/null 2>&1
198205
echo "Updated successfully! Restart editor for changes to take effect."
199206
else
200207
echo "Successfully installed to $editor_name!"

0 commit comments

Comments
 (0)