I changed "if" to "else if" in the patch, so /min and /b couldn't be
used at the same time. And wrote some documentation. Please be patient
reading it, I think there are a lot mistakes in my English :-(.
--- os_win32.c 2010-12-18 17:27:48.016601500 +0200
+++ os_win32.c 2010-12-22 14:53:05.292968700 +0200
@@ -3358,6 +3358,7 @@
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
+ DWORD flags = CREATE_NEW_CONSOLE;
si.cb = sizeof(si);
si.lpReserved = NULL;
@@ -3375,6 +3376,22 @@
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.
@@ -3402,7 +3419,7 @@
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
@@ -3415,6 +3432,11 @@
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);
--- os_win32.txt 2010-09-24 23:58:57.034806000 +0300
+++ os_win32.txt 2010-12-22 14:51:12.221679600 +0200
@@ -336,4 +336,31 @@
A. Edit SYSTEM.INI and add 'ScreenLines=50' to the [NonWindowsApp]
section. DOS
prompts and external DOS commands will now run in a 50-line
window.
+Q. I don't want to see programs that I run asynchronously. What
should I do?
+A. You have two possible solutions depending on what exactly do you
want:
+ 1) You may use /min flag that would run program in minimized state
with no
+ other changes. It will work equally for console and GUI
applications.
+ 2) You can use /b flag to run console applications without
creating console
+ window for them (GUI applications are not affected). But you
should use
+ this flag only if application you run doesn't require any
input.
+ Otherwise it will get an EOF error because it's input stream
(stdin)
+ would be redirected to \\.\NUL (stdour and stderr too).
+ Also remember that you should use only one of these flags at a
time.
+ Otherwise second one would be treated as start of an execution
name.
+
+ Example for console application:
+ If you have Exuberant ctags try to run this: >
+ :!start /min ctags -R .
+< now you should see file named "tags" in your current directory.
You should
+ noticed blinking on your taskbar. Now delete the "tags" file and
run this
+ command: >
+ :!start /b ctags -R .
+< you should have the same "tags" file, but this time there must be
no
+ blinking on the taskbar.
+ Example for GUI application (notepad): >
+ :!start /min notepad
+ :!start /b notepad
+< the first command runs notepad minimized and the second one runs
it
+ normally.
+
vim:tw=78:fo=tcq2:ts=8:ft=help:norl:
--
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