diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2013-12-20 09:42:39 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2013-12-20 09:42:39 -0800 |
commit | 259d205ff6c44e086371f2a7b28a9345257d094e (patch) | |
tree | 92d1d8306cc233b46d9f1190192f3077f5f0c876 /lib/system.nim | |
parent | 22e88026afc9e662206aea5c6de742ed680cc3dd (diff) | |
parent | 7d5fa3f52d23c4f238c1664fc568eb7f3c6a34b6 (diff) | |
download | Nim-259d205ff6c44e086371f2a7b28a9345257d094e.tar.gz |
Merge pull request #759 from zielmicha/stdmsg
Write tracebacks to stderr instead of stdout.
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/system.nim b/lib/system.nim index d7a9b08ab..106eb04a3 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1951,15 +1951,13 @@ when not defined(JS): #and not defined(NimrodVM): ## The standard output stream. stderr* {.importc: "stderr", header: "<stdio.h>".}: TFile ## The standard error stream. - ## - ## Note: In my opinion, this should not be used -- the concept of a - ## separate error stream is a design flaw of UNIX. A separate *message - ## stream* is a good idea, but since it is named ``stderr`` there are few - ## programs out there that distinguish properly between ``stdout`` and - ## ``stderr``. So, that's what you get if you don't name your variables - ## appropriately. It also annoys people if redirection - ## via ``>output.txt`` does not work because the program writes - ## to ``stderr``. + + when defined(useStdoutAsStdmsg): + template stdmsg*: TFile = stdout + else: + template stdmsg*: TFile = stderr + ## Template which expands to either stdout or stderr depending on + ## `useStdoutAsStdmsg` compile-time switch. proc Open*(f: var TFile, filename: string, mode: TFileMode = fmRead, bufSize: int = -1): Bool {.tags: [].} |