pclose() returns -1 only in specific cases, otherwise it returns the
exit status of the child, to be retrieved by the macro WEXITSTATUS.
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