delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2010/05/05/17:15:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT havenone DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: redirect stderr to stdout/file in djgpp 2.x
Date: Wed, 5 May 2010 17:03:35 -0400
Organization: Aioe.org NNTP Server
Lines: 36
Message-ID: <hrsmbr$a4j$1@speranza.aioe.org>
References: <97e7dd63-3c51-4796-a5ba-c8a1cddaabbc AT w17g2000yqj DOT googlegroups DOT com> <E1NztLP-0001Fs-6b AT fencepost DOT gnu DOT org> <57a05b96-b688-4c09-93b5-f2bd3d2501a1 AT r18g2000yqd DOT googlegroups DOT com> <hq513o$54j$1 AT speranza DOT aioe DOT org> <83633tye60 DOT fsf AT gnu DOT org>
NNTP-Posting-Host: pldq+kT97bAAp/ObDwnZyQ.user.speranza.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1983
X-Notice: Filtered by postfilter v. 0.8.2
X-Newsreader: Microsoft Outlook Express 6.00.2800.1983
X-Priority: 3
X-MSMail-Priority: Normal
Bytes: 2455
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Eli Zaretskii" <eliz AT gnu DOT org> wrote in message
news:83633tye60 DOT fsf AT gnu DOT org...
> > "Rod Pemberton" <do_not_have AT havenone DOT cmm>
> >
> > I've noticed that both John's TSR and DJGPP's redir.exe don't interleave
> > stderr and stdout messages the way they are emitted to the screen.  Both
> > seem to write out stderr messages to the file first followed by stdout.
>
> Actually, redir.exe does nothing of the kind.  In particular, it
> doesn't write anything, and thus cannot control the order in which
> stdout and stderr output are interleaved.  What redir.exe does is just
> redirect stderr to the same file or device as stdout.  The actual
> writes are done by the program that is invoked under redir.exe.
>
> It could be that you get the _impression_ that this is what redir.exe
> does, because stderr is usually unbuffered, and so tends to be flushed
> by the library and the OS sooner than stdout.  But this is something
> redir.exe has no control of, and cannot change, the way it was
> designed and implemented.
>

OpenWatcom 16-bit/32-bit app's also interleave stderr and stdout message
correctly when emitted to the screen but fail to do so when redirected to a
file via redir.exe or John's TSR.  When redirected to a file, all stderr
messages are first and all stdout messages are last.  So, it seems this is
something to do with DOS' redirection mechanism.  Or, perhaps it's an issue
with DOS' buffering as you've stated.


Rod Pemberton






- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019