[GRASS-dev] Merging stdout and stderr

Michael Barton michael.barton at asu.edu
Mon Nov 13 23:28:19 EST 2006

Paul and Glynn,

I just want to thank you guys for the work you are coordinating to make
wingrass a reality. Although I don't use Windows, getting GRASS to run on
Windows will make it easy for me to require this for all classes using GIS.

Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

> From: Paul Kelly <paul-grass at stjohnspoint.co.uk>
> Date: Mon, 13 Nov 2006 22:14:20 +0000 (GMT)
> To: <grass-dev at grass.itc.it>
> Subject: [GRASS-dev] Merging stdout and stderr
> The GRASS console thing (I guess that's where the name gronsole comes
> from?) which runs commands via the Tcl/Tk "open" command and captures
> their stdout and stderr, displaying some output as-is to the gronsole
> window and catching certain things like percentage complete and warnings
> and displaying them differently is actually quite cool.
> I remember discussion on the list about how stdout and stderr had to be
> merged because Tcl/Tk has a bug/feature in that it treats anything written
> to stderr as an error indicator for the called program. On Unix this
> merging is done as follows:
> set cmd [concat | $cmd 2>@ stdout]
> but the "2>@ stdout" syntax will not work on Windows. A cross-platform
> solution would be to use the "|&" redirector instead of "2>@". "|&" means
> "pipe both stdout and stderr to stdin of the following command" (see
> http://www.tcl.tk/man/tcl8.5/tutorial/Tcl26.html ). This command could
> then copy everything to its stdout and that's what gronsole gets back.
> The Unix cat command is an obvious choice but it isn't available on
> Windows. "more" kind of works but it's a shell (cmd.exe) built-in command
> on Windows so not suitable either. I was wondering if anybody has any
> thoughts on
> 1. Are there any other Windows commands that might be suitable for this?
> or
> 2. Might it be a worthwhile idea to include a simple program with GRASS
> that did this (copies everything from stdin to stdout) so we can be sure
> what's going on?
> I know I could get this working some hackish way but would like to do it
> as elegantly as possible - so it would be great if we can come up with
> something.
> Paul

More information about the grass-dev mailing list