Patch 8.0.0501
Problem: On MS-Windows ":!start" does not work as expected.
Solution: When creating a process fails try passing the argument to
ShellExecute(). (Katsuya Hino, closes #1570)
Files: runtime/doc/os_win32.txt, src/os_win32.c
*** ../vim-8.0.0500/runtime/doc/os_win32.txt 2016-10-12 14:19:55.734357838
+0200
--- runtime/doc/os_win32.txt 2017-03-21 19:27:35.298117488 +0100
***************
*** 212,221 ****
be able to set the blink rate for all console windows at the same time.
*:!start*
! Q. How can I run an external command or program asynchronously?
! A. When using :! to run an external command, you can run it with "start": >
! :!start winfile.exe<CR>
! < Using "start" stops Vim switching to another screen, opening a new console,
or waiting for the program to complete; it indicates that you are running a
program that does not affect the files you are editing. Programs begun
with :!start do not get passed Vim's open file handles, which means they do
--- 212,230 ----
be able to set the blink rate for all console windows at the same time.
*:!start*
! Q. How can I asynchronously run an external command or program, or open a
! document or URL with its default program?
! A. When using :! to run an external command, you can run it with "start". For
! example, to run notepad: >
! :!start notepad
! < To open "image.jpg" with the default image viewer: >
! :!start image.jpg
! < To open the folder of the current file in Windows Explorer: >
! :!start %:h
! < To open the Vim home page with the default browser: >
! :!start http://www.vim.org/
! <
! Using "start" stops Vim switching to another screen, opening a new console,
or waiting for the program to complete; it indicates that you are running a
program that does not affect the files you are editing. Programs begun
with :!start do not get passed Vim's open file handles, which means they do
*** ../vim-8.0.0500/src/os_win32.c 2017-03-12 20:09:59.484468262 +0100
--- src/os_win32.c 2017-03-21 19:23:31.979892320 +0100
***************
*** 4008,4013 ****
--- 4008,4035 ----
}
+ static HINSTANCE
+ vim_shell_execute(
+ char *cmd,
+ INT n_show_cmd)
+ {
+ #ifdef FEAT_MBYTE
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+ {
+ WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
+ if (wcmd != NULL)
+ {
+ HINSTANCE ret;
+ ret = ShellExecuteW(NULL, NULL, wcmd, NULL, NULL, n_show_cmd);
+ vim_free(wcmd);
+ return ret;
+ }
+ }
+ #endif
+ return ShellExecute(NULL, NULL, cmd, NULL, NULL, n_show_cmd);
+ }
+
+
#if defined(FEAT_GUI_W32) || defined(PROTO)
/*
***************
*** 4711,4716 ****
--- 4733,4739 ----
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD flags = CREATE_NEW_CONSOLE;
+ INT n_show_cmd = SW_SHOWNORMAL;
char_u *p;
ZeroMemory(&si, sizeof(si));
***************
*** 4729,4734 ****
--- 4752,4758 ----
cmdbase = skipwhite(cmdbase + 4);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWMINNOACTIVE;
+ n_show_cmd = SW_SHOWMINNOACTIVE;
}
else if ((STRNICMP(cmdbase, "/b", 2) == 0)
&& VIM_ISWHITE(cmdbase[2]))
***************
*** 4800,4805 ****
--- 4824,4832 ----
*/
if (vim_create_process((char *)newcmd, FALSE, flags, &si, &pi))
x = 0;
+ else if (vim_shell_execute((char *)newcmd, n_show_cmd)
+ > (HINSTANCE)32)
+ x = 0;
else
{
x = -1;
*** ../vim-8.0.0500/src/version.c 2017-03-21 18:02:35.475348003 +0100
--- src/version.c 2017-03-21 19:23:14.480019973 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 501,
/**/
--
Wizards had always known that the act of observation changed the thing that
was observed, and sometimes forgot that it also changed the observer too.
Terry Pratchett - Interesting times
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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].
For more options, visit https://groups.google.com/d/optout.