Add console title for Windows.

This commit is contained in:
XMRig 2019-12-24 02:04:34 +07:00
parent ea7aa4ccef
commit 2e4a83547d
No known key found for this signature in database
GPG key ID: 446A53638BE94409
2 changed files with 8 additions and 5 deletions

View file

@ -27,9 +27,10 @@
#include <cstdio>
#include "base/tools/Handle.h"
#include "base/io/log/backends/ConsoleLog.h"
#include "base/tools/Handle.h"
#include "base/io/log/Log.h"
#include "version.h"
xmrig::ConsoleLog::ConsoleLog()
@ -48,7 +49,7 @@ xmrig::ConsoleLog::ConsoleLog()
uv_tty_set_mode(m_tty, UV_TTY_MODE_NORMAL);
# ifdef WIN32
# ifdef XMRIG_OS_WIN
m_stream = reinterpret_cast<uv_stream_t*>(m_tty);
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
@ -59,6 +60,8 @@ xmrig::ConsoleLog::ConsoleLog()
SetConsoleMode(handle, mode | ENABLE_EXTENDED_FLAGS);
}
}
SetConsoleTitleA(APP_NAME " " APP_VERSION);
# endif
}
@ -75,7 +78,7 @@ void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool c
return;
}
# ifdef _WIN32
# ifdef XMRIG_OS_WIN
uv_buf_t buf = uv_buf_init(const_cast<char *>(line), static_cast<unsigned int>(size));
if (!isWritable()) {
@ -99,7 +102,7 @@ bool xmrig::ConsoleLog::isSupported() const
}
#ifdef WIN32
#ifdef XMRIG_OS_WIN
bool xmrig::ConsoleLog::isWritable() const
{
if (!m_stream || uv_is_writable(m_stream) != 1) {

View file

@ -54,7 +54,7 @@ private:
uv_tty_t *m_tty = nullptr;
# ifdef _WIN32
# ifdef XMRIG_OS_WIN
bool isWritable() const;
uv_stream_t *m_stream = nullptr;