runtime(open): Use job_start() on Linux

Commit: 
https://github.com/vim/vim/commit/71fd19d7ac9e83bf63d7bad337f43cd830a5b5bd
Author: Christian Brabandt <[email protected]>
Date:   Tue Mar 10 20:42:43 2026 +0000

    runtime(open): Use job_start() on Linux
    
    Problem:  With zsh, executing :!nohup xdg-open url >/dev/null 2>&1 &
              does not launch the browser. This occurs presumably because
              gvim/zsh cleans up background processes in a non-interactive
              session too quickly.
    Solution: Use job_start() with "stoponexit" set to an empty string.
              This bypasses the shell entirely (fixing the zsh issue)
              and ensures the browser process is not killed when Vim exits.
              On Linux, shellescape() is removed as job_start() in list
              mode handles special characters natively.
    
    fixes: #19594
    
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim
index ece21db65..87b3dbb87 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 Jan 31
+# Last Change:  2026 Mar 10
 
 export def IsSafeExecutable(filetype: string, executable: string): bool
   if empty(exepath(executable))
@@ -60,7 +60,9 @@ if has('unix')
     enddef
   else
     export def Launch(args: string)
-      execute $':silent ! nohup {args} {Redir()} &' | redraw!
+      # Use job_start, because using !xdg-open is known not to work with zsh
+      # ignore signals on exit
+      job_start(split(args), {'stoponexit': ''})
     enddef
   endif
 elseif has('win32')
@@ -137,7 +139,13 @@ export def Open(file: string)
     setlocal shell&
     defer setbufvar('%', '&shell', shell)
   endif
-  Launch($"{Viewer()} {shellescape(file, 1)}")
+  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
 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/E1w04BP-00GbDw-HP%40256bit.org.

Raspunde prin e-mail lui