@@ -704,11 +704,18 @@ int execute (
704704 SECURITY_ATTRIBUTES saAttr = {sizeof (SECURITY_ATTRIBUTES), NULL , TRUE };
705705
706706 // Create pipes for the child process's STDOUT and STDIN
707- if (!CreatePipe (&hChildStdOutRd, &hChildStdOutWr, &saAttr, 0 ) ||
708- !SetHandleInformation (hChildStdOutRd, HANDLE_FLAG_INHERIT, 0 ) ||
709- !CreatePipe (&hChildStdInRd, &hChildStdInWr, &saAttr, 0 ) ||
710- !SetHandleInformation (hChildStdInWr, HANDLE_FLAG_INHERIT, 0 ))
711- return -1 ;
707+ if (!CreatePipe (&hChildStdOutRd, &hChildStdOutWr, &saAttr, 0 )) {
708+ return -1 * static_cast <int >(GetLastError ());
709+ }
710+ if (!SetHandleInformation (hChildStdOutRd, HANDLE_FLAG_INHERIT, 0 )) {
711+ return -1 * static_cast <int >(GetLastError ());
712+ }
713+ if (!CreatePipe (&hChildStdInRd, &hChildStdInWr, &saAttr, 0 )) {
714+ return -1 * static_cast <int >(GetLastError ());
715+ }
716+ if (!SetHandleInformation (hChildStdInWr, HANDLE_FLAG_INHERIT, 0 )) {
717+ return -1 * static_cast <int >(GetLastError ());
718+ }
712719
713720 // Prepare the child process
714721 PROCESS_INFORMATION piProcInfo = {0 };
0 commit comments