[GRASS-dev] [grass-code I][478] tcl/tk gui startup screen launches grass even when 'Exit' is pushed

Paul Kelly paul-grass at stjohnspoint.co.uk
Tue Sep 25 13:00:10 EDT 2007


On Mon, 24 Sep 2007, Maris Nartiss wrote:

> 2007/9/24, Paul Kelly <paul-grass at stjohnspoint.co.uk>:
>>
>> I think it would simplify things if we made Init.sh always exit when a
>> non-zero exit code is returned from gis_set.tcl- any other thoughts? (I
>> should probably update init.bat too so it goes ahead when 0 is returned,
>> rather than exiting when 1 is returned).
> As I wrote - user exit is not an error. If You think, that GRASS
> should not use text mode as failback - that's OK, but still there
> should be as minimum 3 cases - no error (start GRASS); error (print
> error and exit or use text mode) and user exit (just exit GRASS).

What about:

returns 0: indicates location and mapset set successfully, init script 
goes on to launch GRASS.
returns 1: indicates user exit, init script exits and returns a value of 0 
to the system.
returns any other value: indicates an error, init script exits and returns 
the value captured to the system (this allows future expansion of the 
error handling in the GUI gis_set without any changes to either init 
script).

I guess my only real objection to the patch was that the number 2 seemed 
like an obscure value to choose for the specific (and common) condition 
that a user had clicked exit, and that the python version and any future 
versions of gis_set.tcl would presumably (I haven't checked) need to be 
modified to return 2 on this condition.

Another option (to make it even clearer that the user clicking exit was a 
special case and not a "normal" error) could be that that resulted in a 
return value of -1, and any positive return value indicated an error, but 
I have no idea how cross-platform/GUI scripting language-compatible that 
would be.

Paul




More information about the grass-dev mailing list