Console: returned stdin check to constructor

master
SChernykh 1 year ago
parent 21f827112d
commit 44d2005ab1

@ -43,6 +43,7 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
, m_readBuf{}
, m_readBufInUse(false)
{
const uv_handle_type stdin_type = uv_guess_handle(0);
LOGINFO(3, "uv_guess_handle returned " << static_cast<int>(stdin_type));
if (stdin_type != UV_TTY && stdin_type != UV_NAMED_PIPE) {
LOGERR(1, "tty or named pipe is not available");
@ -101,7 +102,7 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
if (m_pool->api() && m_pool->params().m_localStats) {
m_pool->api()->set(p2pool_api::Category::LOCAL, "console",
[this](log::Stream& s)
[stdin_type, this](log::Stream& s)
{
s << "{\"mode\":" << ((stdin_type == UV_TTY) ? "\"tty\"" : "\"pipe\"")
<< ",\"tcp_port\":" << m_listenPort

@ -32,8 +32,6 @@ static constexpr char log_file_name[] = "p2pool.log";
namespace p2pool {
const uv_handle_type stdin_type = uv_guess_handle(0);
namespace log {
int GLOBAL_LOG_LEVEL = 3;

@ -25,8 +25,6 @@ static_assert(sizeof(in_addr) == 4, "struct in_addr has invalid size");
namespace p2pool {
extern const uv_handle_type stdin_type;
struct MutexLock : public nocopy_nomove
{
explicit FORCEINLINE MutexLock(uv_mutex_t& handle) : m_handle(&handle) { uv_mutex_lock(&handle); }

Loading…
Cancel
Save