1
0
mirror of synced 2024-11-24 15:50:16 +01:00

fix: Properly discard reopened stderr

This commit is contained in:
WerWolv 2023-03-18 11:47:42 +01:00
parent 7c1e33dde6
commit e00b59c393

View File

@ -9,6 +9,8 @@
#include <hex/helpers/utils.hpp>
#include <hex/helpers/logger.hpp>
#include <wolv/utils/core.hpp>
#include <nlohmann/json.hpp>
#include <cstdio>
#include <sys/wait.h>
@ -27,7 +29,7 @@ namespace hex {
// Various libraries sadly directly print to stderr with no way to disable it
// We redirect stderr to /dev/null to prevent this
freopen("/dev/null", "w", stderr);
wolv::util::unused(freopen("/dev/null", "w", stderr));
setvbuf(stderr, nullptr, _IONBF, 0);
// Redirect stdout to log file if we're not running in a terminal