> Why /hidden? The docs for "start" mention /b.
I didn't notice that "start" has "/min" flag. You're right, "/b" must
be used.
> This needs to be properly documented, especially what commands can be
> run this way and what happens if the command tries to read input anyway.
> And verify this on different systems, especially Windows XP and Windows
> 7.
All programs can be run this way, even GUI applications by mistake
(because it affects only console applications).
If program tries to read input it will be hanging in the memory. This
can be fixed by redirecting them to \\.\NUL, so program will get EOF
on read and no error on write. I don't handle the situation when
CreateFile can't open \\.\NUL, because I don't think it's necessary
and I don't know what error message should be used.
It has been tested on Windows XP and Windows 7, on both it works like
described above.
> For the diff, please use "diff -u" or "diff -c".
*** os_win32.c Sat Dec 18 17:27:48 2010
--- os_win32.c Sun Dec 19 17:29:52 2010
***************
*** 3358,3363 ****
--- 3358,3364 ----
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
+ DWORD flags = CREATE_NEW_CONSOLE;
si.cb = sizeof(si);
si.lpReserved = NULL;
***************
*** 3375,3380 ****
--- 3376,3397 ----
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWMINNOACTIVE;
}
+ 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,3408 ****
NULL, // Process security attributes
NULL, // Thread security attributes
FALSE, // Inherit handles
! CREATE_NEW_CONSOLE, // Creation flags
NULL, // Environment
NULL, // Current directory
&si, // Startup information
--- 3419,3425 ----
NULL, // Process security attributes
NULL, // Thread security attributes
FALSE, // Inherit handles
! flags, // Creation flags
NULL, // Environment
NULL, // Current directory
&si, // Startup information
***************
*** 3415,3420 ****
--- 3432,3442 ----
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);
--
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