mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-22 18:54:43 +00:00
Add console title for Windows.
This commit is contained in:
parent
ea7aa4ccef
commit
2e4a83547d
2 changed files with 8 additions and 5 deletions
|
@ -27,9 +27,10 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
|
||||||
#include "base/tools/Handle.h"
|
|
||||||
#include "base/io/log/backends/ConsoleLog.h"
|
#include "base/io/log/backends/ConsoleLog.h"
|
||||||
|
#include "base/tools/Handle.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
xmrig::ConsoleLog::ConsoleLog()
|
xmrig::ConsoleLog::ConsoleLog()
|
||||||
|
@ -48,7 +49,7 @@ xmrig::ConsoleLog::ConsoleLog()
|
||||||
|
|
||||||
uv_tty_set_mode(m_tty, UV_TTY_MODE_NORMAL);
|
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);
|
m_stream = reinterpret_cast<uv_stream_t*>(m_tty);
|
||||||
|
|
||||||
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
|
@ -59,6 +60,8 @@ xmrig::ConsoleLog::ConsoleLog()
|
||||||
SetConsoleMode(handle, mode | ENABLE_EXTENDED_FLAGS);
|
SetConsoleMode(handle, mode | ENABLE_EXTENDED_FLAGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetConsoleTitleA(APP_NAME " " APP_VERSION);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +78,7 @@ void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool c
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef _WIN32
|
# ifdef XMRIG_OS_WIN
|
||||||
uv_buf_t buf = uv_buf_init(const_cast<char *>(line), static_cast<unsigned int>(size));
|
uv_buf_t buf = uv_buf_init(const_cast<char *>(line), static_cast<unsigned int>(size));
|
||||||
|
|
||||||
if (!isWritable()) {
|
if (!isWritable()) {
|
||||||
|
@ -99,7 +102,7 @@ bool xmrig::ConsoleLog::isSupported() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef XMRIG_OS_WIN
|
||||||
bool xmrig::ConsoleLog::isWritable() const
|
bool xmrig::ConsoleLog::isWritable() const
|
||||||
{
|
{
|
||||||
if (!m_stream || uv_is_writable(m_stream) != 1) {
|
if (!m_stream || uv_is_writable(m_stream) != 1) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ private:
|
||||||
|
|
||||||
uv_tty_t *m_tty = nullptr;
|
uv_tty_t *m_tty = nullptr;
|
||||||
|
|
||||||
# ifdef _WIN32
|
# ifdef XMRIG_OS_WIN
|
||||||
bool isWritable() const;
|
bool isWritable() const;
|
||||||
|
|
||||||
uv_stream_t *m_stream = nullptr;
|
uv_stream_t *m_stream = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue