From 93003eee165f7e98aa7486acbec9b175f7a30ff2 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Wed, 17 Aug 2016 22:58:13 +0200 Subject: [PATCH] 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 fb46b3a1ee642b66b9712c6f376f543c47a2695e) --- src/support/filetools.cpp | 6 +++++- status.22x | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 310e621e17..ff9ea8110a 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -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) diff --git a/status.22x b/status.22x index 5238983a9a..412b7c6cc2 100644 --- a/status.22x +++ b/status.22x @@ -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. -- 2.39.5