Fix exit code from runCommand on Windows

On Windows, runCommand has never returned the exit code of the
spawned process but the result of correctly closing the input handle.

Fixes #10327

(cherry picked from commit fb46b3a1ee)
This commit is contained in:
Enrico Forestieri 2016-08-17 22:58:13 +02:00 committed by Richard Heck
parent 1a89f89337
commit 93003eee16
2 changed files with 7 additions and 1 deletions

View File

@ -1093,10 +1093,14 @@ cmd_ret const runCommand(string const & cmd)
#if defined (_WIN32)
WaitForSingleObject(process.hProcess, INFINITE);
DWORD pret;
if (!GetExitCodeProcess(process.hProcess, &pret))
pret = -1;
if (!infile.empty())
CloseHandle(startup.hStdInput);
CloseHandle(process.hProcess);
int const pret = fclose(inf);
if (fclose(inf) != 0)
pret = -1;
#elif defined (HAVE_PCLOSE)
int const pret = pclose(inf);
#elif defined (HAVE__PCLOSE)

View File

@ -66,6 +66,8 @@ What's new
- Avoid crashing in release mode if we stumble across an unrealized font.
- Correctly return exit code from spawned processes on Windows (bug 10327).
- Fix display of citations with two authors.
- Fix display of multi-author citations when the GUI language is not English.