No handles were inherited in CreateProcess, all child console programs
were silent.
Eric Pouech <pouech-eric@wanadoo.fr>
Ensure redirected stream handle for child process are actually
inheritable.

diff --git a/programs/wcmd/wcmdmain.c b/programs/wcmd/wcmdmain.c
index 3044a5a..cd6b60a 100644
--- a/programs/wcmd/wcmdmain.c
+++ b/programs/wcmd/wcmdmain.c
@@ -260,7 +260,7 @@
     DWORD count;
     HANDLE old_stdin = 0, old_stdout = 0, h;
     char *whichcmd;
-
+    SECURITY_ATTRIBUTES sa;
 
 /*
  *	Expand up environment variables.
@@ -287,12 +287,15 @@
 
     /* Dont issue newline WCMD_output (newline);           @JED*/
 
+    sa.nLength = sizeof(sa);
+    sa.lpSecurityDescriptor = NULL;
+    sa.bInheritHandle = TRUE;
 /*
  *	Redirect stdin and/or stdout if required.
  */
 
     if ((p = strchr(cmd,'<')) != NULL) {
-      h = CreateFile (WCMD_parameter (++p, 0, NULL), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+      h = CreateFile (WCMD_parameter (++p, 0, NULL), GENERIC_READ, FILE_SHARE_READ, &sa, OPEN_EXISTING,
 		FILE_ATTRIBUTE_NORMAL, NULL);
       if (h == INVALID_HANDLE_VALUE) {
 	WCMD_print_error ();
@@ -303,7 +306,7 @@
       SetStdHandle (STD_INPUT_HANDLE, h);
     }
     if ((p = strchr(cmd,'>')) != NULL) {
-      h = CreateFile (WCMD_parameter (++p, 0, NULL), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+      h = CreateFile (WCMD_parameter (++p, 0, NULL), GENERIC_WRITE, 0, &sa, CREATE_ALWAYS,
 		FILE_ATTRIBUTE_NORMAL, NULL);
       if (h == INVALID_HANDLE_VALUE) {
 	WCMD_print_error ();
@@ -531,8 +534,8 @@
   console = SHGetFileInfo (filetorun, 0, &psfi, sizeof(psfi), SHGFI_EXETYPE);
   ZeroMemory (&st, sizeof(STARTUPINFO));
   st.cb = sizeof(STARTUPINFO);
-  status = CreateProcess (NULL, command, NULL, NULL, FALSE,
-  		 0, NULL, NULL, &st, &pe);
+  status = CreateProcess (NULL, command, NULL, NULL, TRUE, 
+                          0, NULL, NULL, &st, &pe);
   if (!status) {
     WCMD_print_error ();
     return;
@@ -544,6 +547,8 @@
       GetExitCodeProcess (pe.hProcess, &errorlevel);
       if (errorlevel == STILL_ACTIVE) errorlevel = 0;
   }
+  CloseHandle(pe.hProcess);
+  CloseHandle(pe.hThread);
 }
 
 /******************************************************************************