Karsten Hopp cb9530
To: vim_dev@googlegroups.com
Karsten Hopp cb9530
Subject: Patch 7.3.203
Karsten Hopp cb9530
Fcc: outbox
Karsten Hopp cb9530
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp cb9530
Mime-Version: 1.0
Karsten Hopp cb9530
Content-Type: text/plain; charset=UTF-8
Karsten Hopp cb9530
Content-Transfer-Encoding: 8bit
Karsten Hopp cb9530
------------
Karsten Hopp cb9530
Karsten Hopp cb9530
Patch 7.3.203
Karsten Hopp cb9530
Problem:    MS-Windows: Can't run an external command without a console window.
Karsten Hopp cb9530
Solution:   Support ":!start /b cmd". (Xaizek)
Karsten Hopp 03f22d
Files:	    src/os_win32.c
Karsten Hopp cb9530
Karsten Hopp cb9530
Karsten Hopp cb9530
*** ../mercurial/vim73/src/os_win32.c	2011-05-05 18:31:54.000000000 +0200
Karsten Hopp cb9530
--- src/os_win32.c	2011-05-25 16:45:31.000000000 +0200
Karsten Hopp cb9530
***************
Karsten Hopp cb9530
*** 3401,3406 ****
Karsten Hopp cb9530
--- 3401,3407 ----
Karsten Hopp cb9530
  	    {
Karsten Hopp cb9530
  		STARTUPINFO		si;
Karsten Hopp cb9530
  		PROCESS_INFORMATION	pi;
Karsten Hopp cb9530
+ 		DWORD			flags = CREATE_NEW_CONSOLE;
Karsten Hopp cb9530
  
Karsten Hopp cb9530
  		si.cb = sizeof(si);
Karsten Hopp cb9530
  		si.lpReserved = NULL;
Karsten Hopp cb9530
***************
Karsten Hopp cb9530
*** 3418,3423 ****
Karsten Hopp cb9530
--- 3419,3440 ----
Karsten Hopp cb9530
  		    si.dwFlags = STARTF_USESHOWWINDOW;
Karsten Hopp cb9530
  		    si.wShowWindow = SW_SHOWMINNOACTIVE;
Karsten Hopp cb9530
  		}
Karsten Hopp cb9530
+ 		else if ((STRNICMP(cmdbase, "/b", 2) == 0)
Karsten Hopp cb9530
+ 			&& vim_iswhite(cmdbase[2]))
Karsten Hopp cb9530
+ 		{
Karsten Hopp cb9530
+ 		    cmdbase = skipwhite(cmdbase + 2);
Karsten Hopp cb9530
+ 		    flags = CREATE_NO_WINDOW;
Karsten Hopp cb9530
+ 		    si.dwFlags = STARTF_USESTDHANDLES;
Karsten Hopp cb9530
+ 		    si.hStdInput = CreateFile("\\\\.\\NUL",	// File name
Karsten Hopp cb9530
+ 			GENERIC_READ,				// Access flags
Karsten Hopp cb9530
+ 			0,					// Share flags
Karsten Hopp cb9530
+ 			NULL,					// Security att.
Karsten Hopp cb9530
+ 			OPEN_EXISTING,				// Open flags
Karsten Hopp cb9530
+ 			FILE_ATTRIBUTE_NORMAL,			// File att.
Karsten Hopp cb9530
+ 			NULL);					// Temp file
Karsten Hopp cb9530
+ 		    si.hStdOutput = si.hStdInput;
Karsten Hopp cb9530
+ 		    si.hStdError = si.hStdInput;
Karsten Hopp cb9530
+ 		}
Karsten Hopp cb9530
  
Karsten Hopp cb9530
  		/* When the command is in double quotes, but 'shellxquote' is
Karsten Hopp cb9530
  		 * empty, keep the double quotes around the command.
Karsten Hopp cb9530
***************
Karsten Hopp cb9530
*** 3445,3451 ****
Karsten Hopp cb9530
  			NULL,			// Process security attributes
Karsten Hopp cb9530
  			NULL,			// Thread security attributes
Karsten Hopp cb9530
  			FALSE,			// Inherit handles
Karsten Hopp cb9530
! 			CREATE_NEW_CONSOLE,	// Creation flags
Karsten Hopp cb9530
  			NULL,			// Environment
Karsten Hopp cb9530
  			NULL,			// Current directory
Karsten Hopp cb9530
  			&si,			// Startup information
Karsten Hopp cb9530
--- 3462,3468 ----
Karsten Hopp cb9530
  			NULL,			// Process security attributes
Karsten Hopp cb9530
  			NULL,			// Thread security attributes
Karsten Hopp cb9530
  			FALSE,			// Inherit handles
Karsten Hopp cb9530
! 			flags,			// Creation flags
Karsten Hopp cb9530
  			NULL,			// Environment
Karsten Hopp cb9530
  			NULL,			// Current directory
Karsten Hopp cb9530
  			&si,			// Startup information
Karsten Hopp cb9530
***************
Karsten Hopp cb9530
*** 3458,3463 ****
Karsten Hopp cb9530
--- 3475,3485 ----
Karsten Hopp cb9530
  		    EMSG(_("E371: Command not found"));
Karsten Hopp cb9530
  #endif
Karsten Hopp cb9530
  		}
Karsten Hopp cb9530
+ 		if (si.hStdInput != NULL)
Karsten Hopp cb9530
+ 		{
Karsten Hopp cb9530
+ 		    /* Close the handle to \\.\NUL */
Karsten Hopp cb9530
+ 		    CloseHandle(si.hStdInput);
Karsten Hopp cb9530
+ 		}
Karsten Hopp cb9530
  		/* Close the handles to the subprocess, so that it goes away */
Karsten Hopp cb9530
  		CloseHandle(pi.hThread);
Karsten Hopp cb9530
  		CloseHandle(pi.hProcess);
Karsten Hopp cb9530
*** ../vim-7.3.202/src/version.c	2011-05-25 15:16:06.000000000 +0200
Karsten Hopp cb9530
--- src/version.c	2011-05-25 17:05:59.000000000 +0200
Karsten Hopp cb9530
***************
Karsten Hopp cb9530
*** 711,712 ****
Karsten Hopp cb9530
--- 711,714 ----
Karsten Hopp cb9530
  {   /* Add new patch number below this line */
Karsten Hopp cb9530
+ /**/
Karsten Hopp cb9530
+     203,
Karsten Hopp cb9530
  /**/
Karsten Hopp cb9530
Karsten Hopp cb9530
-- 
Karsten Hopp cb9530
hundred-and-one symptoms of being an internet addict:
Karsten Hopp cb9530
108. While reading a magazine, you look for the Zoom icon for a better
Karsten Hopp cb9530
     look at a photograph.
Karsten Hopp cb9530
Karsten Hopp cb9530
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp cb9530
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp cb9530
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp cb9530
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///