From 9d5533013f9bfdbf19d08d12bd48c657eed137b5 Mon Sep 17 00:00:00 2001 From: Milly Date: Mon, 11 Nov 2024 09:17:54 +0900 Subject: [PATCH] fix: restore shell options when aborts --- autoload/codeium/server.vim | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/autoload/codeium/server.vim b/autoload/codeium/server.vim index ff9c1c49..9e34cb18 100644 --- a/autoload/codeium/server.vim +++ b/autoload/codeium/server.vim @@ -238,14 +238,17 @@ function! s:UnzipAndStart(status) abort set shellquote= shellpipe=\| shellxquote= set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command set shellredir=\|\ Out-File\ -Encoding\ UTF8 - call system('& { . ' . shellescape(s:root . '/powershell/gzip.ps1') . '; Expand-File ' . shellescape(s:bin . '.gz') . ' }') - " Restore old settings. - let &shell = old_shell - let &shellquote = old_shellquote - let &shellpipe = old_shellpipe - let &shellxquote = old_shellxquote - let &shellcmdflag = old_shellcmdflag - let &shellredir = old_shellredir + try + call system('& { . ' . shellescape(s:root . '/powershell/gzip.ps1') . '; Expand-File ' . shellescape(s:bin . '.gz') . ' }') + finally + " Restore old settings. + let &shell = old_shell + let &shellquote = old_shellquote + let &shellpipe = old_shellpipe + let &shellxquote = old_shellxquote + let &shellcmdflag = old_shellcmdflag + let &shellredir = old_shellredir + endtry else if !executable('gzip') call codeium#log#Error('Failed to extract language server binary: missing `gzip`.')