From d7910e1870c4e8c427d8854cd68af3ef7de85399 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sun, 11 Dec 2022 12:15:37 +0100 Subject: [PATCH] Amend fb7b7e52 pclose() returns -1 only in specific cases, otherwise it returns the exit status of the child, to be retrieved by the macro WEXITSTATUS. --- src/support/filetools.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index e24dcbaf77..f7460ce188 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1148,10 +1148,10 @@ cmd_ret const runCommand(string const & cmd) valid = false; #elif defined (HAVE_PCLOSE) int const pret = pclose(inf); - bool const valid = (pret != -1); + bool const valid = (WEXITSTATUS(pret) == 0); #elif defined (HAVE__PCLOSE) int const pret = _pclose(inf); - bool const valid = (pret != -1); + bool const valid = (WEXITSTATUS(pret) == 0); #else #error No pclose() function. #endif -- 2.39.5