[GRASS-dev] Re: [GRASS-CVS] michael: grass6/gui/tcltk/gis.m
mapcanvas.tcl, 1.52, 1.53
Hamish
hamish_nospam at yahoo.com
Wed Nov 29 00:20:05 EST 2006
Michael Barton wrote:
> On 11/28/06 6:58 PM, "Hamish" <hamish_nospam at yahoo.com> wrote:
>
> > I changed:
> >
> > - if {![catch {open [concat "|g.region" "-ug" $args] r} input]} {
> > + set regcmd [concat "|g.region" "-ug" $args]
> > + set retval [catch {open $regcmd r} input]
> > + if {! $retval } {
> >
>
> I think this is problematic. The original code says in essence, if
> g.region does *not* fail, do the following.
g.region returns "0" for EXIT_SUCCESS.
So testing !return_value is the same; if{!0}=if{TRUE}; no problem.
> Looking at the catch command, it should store any error returned in
> the variable input.
>
> Trying replacing the line in the else clause...
>
> puts "GRASS command g.region failed. Check to see if you've install
> GRASS correctly."
>
> With...
>
> puts $input
I never get there as catch always returns 0 for me, even when g.region
failed.
If I move "puts $input" before if {! $retval } above, that prints
"file8" or "file9", presumably the name of the $input stream that gets()
works on.
Hamish
More information about the grass-dev
mailing list