[GRASS-dev] another not quiet GRASS command
Paul Kelly
paul-grass at stjohnspoint.co.uk
Mon Sep 3 13:06:26 EDT 2007
On Mon, 3 Sep 2007, Michael Barton wrote:
> The problem in this and other cases is that the warning is sent to stderr
> when the command operates and exits properly. Error messages are sent to
> stderr when the command does not operate properly and/or exits with an
> error. There is no easy way (maybe no way in many cases) for a script to
> tell the difference.
I think Tcl's deficiencies are confusing you. Tcl cannot tell the
difference and this is IMHO a major bug in Tcl. But it is a single
exception. Operating systems and probably almost all other scripting
languages use the exit code of the program: a zero exit code indicates it
exited successfully; a non-zero exit code indicates it exited with an
error.
In any case Maris seems to have found a workaround to Tcl's deficiency:
check the global variable errorcode after running an external command. I'm
waiting to see if anybody comes up with a problem with this approach.
More information about the grass-dev
mailing list