diff options
author | Bram Moolenaar <Bram@vim.org> | 2011-05-25 17:06:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2011-05-25 17:06:22 +0200 |
commit | bd8608d979db1f725551215d8a78dcecbb9bb98a (patch) | |
tree | 9c2045387eb5b9e29ddcd36985c66a78d08c97d3 /src | |
parent | ed38b0ac415b84a10f7c3cf3e5aae34d834187f1 (diff) | |
download | vim-bd8608d979db1f725551215d8a78dcecbb9bb98a.zip |
updated for version 7.3.203
Problem: MS-Windows: Can't run an external command without a console window.
Solution: Support ":!start /b cmd". (Xaizek)
Diffstat (limited to 'src')
-rw-r--r-- | src/os_win32.c | 24 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index 179ee64ad..d4ef93988 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -3401,6 +3401,7 @@ mch_call_shell( { STARTUPINFO si; PROCESS_INFORMATION pi; + DWORD flags = CREATE_NEW_CONSOLE; si.cb = sizeof(si); si.lpReserved = NULL; @@ -3418,6 +3419,22 @@ mch_call_shell( si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOWMINNOACTIVE; } + else if ((STRNICMP(cmdbase, "/b", 2) == 0) + && vim_iswhite(cmdbase[2])) + { + cmdbase = skipwhite(cmdbase + 2); + flags = CREATE_NO_WINDOW; + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = CreateFile("\\\\.\\NUL", // File name + GENERIC_READ, // Access flags + 0, // Share flags + NULL, // Security att. + OPEN_EXISTING, // Open flags + FILE_ATTRIBUTE_NORMAL, // File att. + NULL); // Temp file + si.hStdOutput = si.hStdInput; + si.hStdError = si.hStdInput; + } /* When the command is in double quotes, but 'shellxquote' is * empty, keep the double quotes around the command. @@ -3445,7 +3462,7 @@ mch_call_shell( NULL, // Process security attributes NULL, // Thread security attributes FALSE, // Inherit handles - CREATE_NEW_CONSOLE, // Creation flags + flags, // Creation flags NULL, // Environment NULL, // Current directory &si, // Startup information @@ -3458,6 +3475,11 @@ mch_call_shell( EMSG(_("E371: Command not found")); #endif } + if (si.hStdInput != NULL) + { + /* Close the handle to \\.\NUL */ + CloseHandle(si.hStdInput); + } /* Close the handles to the subprocess, so that it goes away */ CloseHandle(pi.hThread); CloseHandle(pi.hProcess); diff --git a/src/version.c b/src/version.c index a85d4de64..d8811b268 100644 --- a/src/version.c +++ b/src/version.c @@ -710,6 +710,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 203, +/**/ 202, /**/ 201, |