How to? SAFEECHO to stderr

May 31, 2008
382
2
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)
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
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.