runtime(vim9): Fix dist#vim9#Open() spaced paths and SIGPIPE crashes
Commit:
https://github.com/vim/vim/commit/48581f2ba96550f5499cc322647b2ff1df5ad4ed
Author: Furkan Sahin <[email protected]>
Date: Mon Apr 6 12:43:07 2026 +0000
runtime(vim9): Fix dist#vim9#Open() spaced paths and SIGPIPE crashes
Problem: dist#vim9#Open() fails to open files with spaces on Linux
because Launch() splits the command string. Also,
background GUI viewers (e.g., xdg-open) crash with SIGPIPE
when Vim destroys the default job_start() IO pipes.
Solution: Use job_start() with 'sh -c' to let the POSIX shell parse
the shellescaped quotes safely. Set 'in_io', 'out_io', and
'err_io' to 'null' to completely detach the background
process and prevent pipe crashes. Unify the Launch()
execution block across all operating systems.
closes: #19928
fixes: #19916
Signed-off-by: Furkan Sahin <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim
index 87b3dbb87..d82467391 100644
--- a/runtime/autoload/dist/vim9.vim
+++ b/runtime/autoload/dist/vim9.vim
@@ -3,7 +3,7 @@ vim9script
# Vim runtime support library
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2026 Mar 10
+# Last Change: 2026 Apr 06
export def IsSafeExecutable(filetype: string, executable: string): bool
if empty(exepath(executable))
@@ -62,7 +62,7 @@ if has('unix')
export def Launch(args: string)
# Use job_start, because using !xdg-open is known not to work with zsh
# ignore signals on exit
- job_start(split(args), {'stoponexit': ''})
+ job_start(['sh', '-c', args], {'stoponexit': '', 'in_io': 'null',
'out_io': 'null', 'err_io': 'null'})
enddef
endif
elseif has('win32')
@@ -139,13 +139,7 @@ export def Open(file: string)
setlocal shell&
defer setbufvar('%', '&shell', shell)
endif
- if has('unix') && !has('win32unix') && !exists('$WSL_DISTRO_NAME')
- # Linux: using job_start, so do not use shellescape.
- Launch($"{Viewer()} {file}")
- else
- # Windows/WSL/Cygwin: NEEDS shellescape because Launch uses '!'
- Launch($"{Viewer()} {shellescape(file, 1)}")
- endif
+ Launch($"{Viewer()} {shellescape(file, 1)}")
enddef
# Uncomment this line to check for compilation errors early
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1w9jKA-006ph4-TP%40256bit.org.