]> git.lyx.org Git - features.git/commitdiff
Amend fb7b7e52
authorEnrico Forestieri <forenr@lyx.org>
Sun, 11 Dec 2022 11:15:37 +0000 (12:15 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Sun, 11 Dec 2022 11:15:37 +0000 (12:15 +0100)
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

index e24dcbaf770942a3bd8fcb54605bbab0a22cdf8a..f7460ce1886fa7435715855cc932627628e63b3d 100644 (file)
@@ -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