mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: Don't supress stderr anymore (#1822)
### Problem description Typing `--help` causes ImHex to exit without outputting anything. Diagnostic messages from glib, ASan, other libraries that might have something important to say, etc. are also suppressed. ### Implementation description This effectively reverts7c1e33dde6, which was partially reverted only on Windows by code that was left commented out inf114239f51. Allowing other libraries to print to stderr may make the output ‘ugly’, but lots of things print to stderr that are important for figuring out why something is bugged, like ASan and glib. ### Additional things 
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include <wolv/utils/core.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <cstdio>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -137,11 +136,6 @@ namespace hex {
|
||||
setenv("LD_LIBRARY_PATH", hex::format("{};{}", hex::getEnvironmentVariable("LD_LIBRARY_PATH").value_or(""), path.string().c_str()).c_str(), true);
|
||||
}
|
||||
|
||||
// Various libraries sadly directly print to stderr with no way to disable it
|
||||
// We redirect stderr to /dev/null to prevent this
|
||||
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
|
||||
if (!isatty(STDOUT_FILENO)) {
|
||||
log::impl::redirectToFile();
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/default_paths.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <imgui_impl_glfw.h>
|
||||
@@ -41,11 +40,6 @@ namespace hex {
|
||||
setenv("LD_LIBRARY_PATH", hex::format("{};{}", hex::getEnvironmentVariable("LD_LIBRARY_PATH").value_or(""), path.string().c_str()).c_str(), true);
|
||||
}
|
||||
|
||||
// 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);
|
||||
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||
|
||||
// Redirect stdout to log file if we're not running in a terminal
|
||||
if (!isatty(STDOUT_FILENO)) {
|
||||
log::impl::redirectToFile();
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <shellapi.h>
|
||||
#include <timeapi.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace hex {
|
||||
|
||||
template<typename T>
|
||||
@@ -422,12 +420,6 @@ namespace hex {
|
||||
reopenConsoleHandle(STD_INPUT_HANDLE, STDIN_FILENO, stdin);
|
||||
reopenConsoleHandle(STD_OUTPUT_HANDLE, STDOUT_FILENO, stdout);
|
||||
|
||||
// Explicitly don't forward stderr because some libraries like to write to it
|
||||
// with no way to disable it (e.g., libmagic)
|
||||
/*
|
||||
reopenConsoleHandle(STD_ERROR_HANDLE, STDERR_FILENO, stderr);
|
||||
*/
|
||||
|
||||
// Enable ANSI colors in the console
|
||||
log::impl::enableColorPrinting();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user