diff options
author | Michał Zieliński <michal@zielinscy.org.pl> | 2013-12-17 20:36:53 +0100 |
---|---|---|
committer | Michał Zieliński <michal@zielinscy.org.pl> | 2013-12-17 20:36:53 +0100 |
commit | db73f3af2027a68e7f9d311a8096c677b6ef4523 (patch) | |
tree | 36399ebf7010324d2a30a614ba91bac653d5eb87 /lib/system.nim | |
parent | 20c69dac9e8d2ae118f54583816008933849cc9e (diff) | |
download | Nim-db73f3af2027a68e7f9d311a8096c677b6ef4523.tar.gz |
Add stdmsg (an alias to either stdout or stderr).
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 dc5a406d1..3fccb4e8b 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1947,15 +1947,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: [].} |