Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not colored output #196

Open
Pythonic-Rainbow opened this issue Sep 16, 2018 · 9 comments
Open

Not colored output #196

Pythonic-Rainbow opened this issue Sep 16, 2018 · 9 comments

Comments

@Pythonic-Rainbow
Copy link

Pythonic-Rainbow commented Sep 16, 2018

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
Copy link
Author

@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 🤷‍♂

@Spudz76
Copy link
Contributor

Spudz76 commented Jul 2, 2019

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
Copy link
Contributor

Spudz76 commented Jul 2, 2019

Proof (from cpu miner but same deal):
image

@Spudz76
Copy link
Contributor

Spudz76 commented Jul 2, 2019

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

@Spudz76
Copy link
Contributor

Spudz76 commented Jul 2, 2019

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)

@Pythonic-Rainbow
Copy link
Author

If this is true, this could be a bug.

@Spudz76
Copy link
Contributor

Spudz76 commented Jul 9, 2019

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
Copy link
Contributor

Spudz76 commented Jul 9, 2019

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.

@Pythonic-Rainbow
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants