I know there is echo
, which writes to stdout. Is it possible to redirect echo
to stderr, or is there another way to write to stderr?
How to write to stderr in Nim?
It is not possible to redirect echo
, but the same can be achieved by using writeLine
on the stderr
handle (no special imports required):
stderr.writeLine("Error: ", 42)
Documentation links:
Another way is to call writeLine
. It is listed among the system
Exports. The docs for echo
suggest also calling flushFile
as below.
writeLine(stderr, "my err")
flushFile(stderr)
This was tested with Nim 1.4.2.
© 2022 - 2024 — McMap. All rights reserved.