xmrig-nvidia icon indicating copy to clipboard operation
xmrig-nvidia copied to clipboard

Not colored output

Open Pythonic-Rainbow opened this issue 7 years ago • 9 comments

image

Launch script:

@echo off
xmrig-nvidia.exe -l cuda.log --donate-level 0 --cuda-bfactor 12 --cuda-bsleep 100 -o sg.minexmr.com:80 -u S340 -p x -k
pause

Pythonic-Rainbow avatar Sep 16 '18 17:09 Pythonic-Rainbow

@xorz57 unlikely, we might have to wait 10 years to get this Windows Terminal covering lots of people. Simply calling them to download may work if we are willing to spend 1-2min, but there are definitely people who don't 🤷‍♂

Pythonic-Rainbow avatar Jun 13 '19 06:06 Pythonic-Rainbow

I find that if I edit the running config file and switch color back on then it reloads on the fly and HAS COLOR JUST FINE

It will always shut it back off at launch, annoying.

Spudz76 avatar Jul 02 '19 18:07 Spudz76

Proof (from cpu miner but same deal): image

Spudz76 avatar Jul 02 '19 18:07 Spudz76

^^^ This is on bog standard Win7 cmd.exe shell not powerjunk or any dumb things

Spudz76 avatar Jul 02 '19 18:07 Spudz76

Oh and I guess to the OP, use a config file not a billion args in a shell script, and you can tweak the color back on too. It has to be config file or the trick doesn't work (obviously, you can't edit and reload a commandline)

Spudz76 avatar Jul 02 '19 19:07 Spudz76

If this is true, this could be a bug.

Pythonic-Rainbow avatar Jul 09 '19 08:07 Pythonic-Rainbow

I've patched this issue and it seems to work fine

diff --git a/src/common/log/ConsoleLog.cpp b/src/common/log/ConsoleLog.cpp
index b10812a..5e243bf 100644
--- a/src/common/log/ConsoleLog.cpp
+++ b/src/common/log/ConsoleLog.cpp
@@ -44,10 +44,14 @@ ConsoleLog::ConsoleLog(xmrig::Controller *controller) :
     m_stream(nullptr),
     m_controller(controller)
 {
+#   ifdef WIN32
+    uv_tty_init(uv_default_loop(), &m_tty, 1, 0);
+#   else
     if (uv_tty_init(uv_default_loop(), &m_tty, 1, 0) < 0) {
         Log::colors = false;
         return;
     }
+#   endif
 
     uv_tty_set_mode(&m_tty, UV_TTY_MODE_NORMAL);
     m_uvBuf.base = m_buf;

Basically, Windows libuv must be returning some weird negative number even though it worked, so skip the check on Windows. Examples of using uv_tty_init() on Windows elsewhere on the Internet never check the return value, so it must be cool not to?

This avoids the colors being shut off due to non-error errorcode being returned.

Similar patch to the other xmrig codebases but in different files...

Spudz76 avatar Jul 09 '19 17:07 Spudz76

PR #283 and PR #284 similar upcoming for xmrig/xmrig-amd

Someone please test on Win10 and/or with PowerShell but I think it works everywhere the same.

Spudz76 avatar Jul 09 '19 19:07 Spudz76

I ain't mining anymore but I will reopen this so more can test for ya

Pythonic-Rainbow avatar Jul 15 '19 17:07 Pythonic-Rainbow