summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-07-17 09:10:14 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-07-22 07:33:38 -0400
commitad77e315f5c53994d75056608df0f9ff0a390530 (patch)
tree486ec4cc333301b62fbe89e72fcdbf2671f60178 /src/main.cpp
parentbca6283311cf1dea4c96f8ee5bf192bdb1640cb3 (diff)
moved Console to util
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8b5648c9..65f4bd05 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -732,46 +732,9 @@ int runApplication(MOApplication &application, SingleInstance &instance,
}
}
-class Console
-{
-public:
- Console()
- {
- // open a console
- AllocConsole();
-
- // redirect stdin, stdout and stderr to it
- freopen_s(&m_in, "CONIN$", "r", stdin);
- freopen_s(&m_out, "CONOUT$", "w", stdout);
- freopen_s(&m_err, "CONOUT$", "w", stderr);
- }
-
- ~Console()
- {
- // close redirected handles
- std::fclose(m_err);
- std::fclose(m_out);
- std::fclose(m_in);
-
- // close console
- FreeConsole();
-
- // redirect stdin, stdout and stderr to NUL, don't bother closing the
- // handles
- freopen_s(&m_in, "NUL", "r", stdin);
- freopen_s(&m_out, "NUL", "w", stdout);
- freopen_s(&m_err, "NUL", "w", stderr);
- }
-
-private:
- FILE* m_in = nullptr;
- FILE* m_out = nullptr;
- FILE* m_err = nullptr;
-};
-
int doCoreDump(env::CoreDumpTypes type)
{
- Console c;
+ env::Console c;
// dump
const auto b = env::coredumpOther(type);