By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!

How to? SAFEECHO to stderr

In another thread http://jpsoft.com/forums/threads/echoerr-truncates-long-lines.3861/ I was trying to echoerr a safechar string and found an issue in the Windows API. So, how can I work around that issue starting with from a safechar string in my hands? The goal is to write it to stderr.

SAFEECHO %@repeat[%@char[%@eval[%@ascii[x]+0xfee0]],%@inc[%_COLUMNS]]
writes to stdout

SAFEECHO 1>&2 %@repeat[%@char[%@eval[%@ascii[x]+0xfee0]],%@inc[%_COLUMNS]]
also writes to stdout

How to write to stderr? (Safechars Version: 1.5 Build 6)
Your second command is writing to stderr.

You probably think it's going to stdout because it doesn't get colored, but AFAIK ErrorColors only applies to internal commands (including plugins) which specifically open a handle to stdout. It doesn't work with redirection; if you do e.g. PING LOCALHOST 1>&2 the output won't be colored.
Isn't the second command I posted an internal command?

Yes, it is. It just isn't opening its own handle to stderr. It's using the default stdout handle, which just happens to be the same as stderr thanks to your redirection.