[GRASS-dev] fixes before 6.2.1 [was: ps.map: scale wrong and no output]

Glynn Clements glynn at gclements.plus.com
Sat Nov 18 12:42:05 EST 2006


Hamish wrote:

> did you figure out how to get the return code from a C module in tcl?
> (like "$?" in bash scripts) to test if the module exited with an error
> or not? [=0 is success, =something else is failure]

"exec" will throw an error if the command either returns a non-zero
exit status or writes to stderr. In the case where the command returns
a non-zero exit status, you can obtain some more information from the
errorCode variable.

For normal termination (i.e. exit() or return from main()), $errorCode
contains:

	CHILDSTATUS <pid> <exit code>
e.g.:
	CHILDSTATUS 21103 1

For termination on a signal, $errorCode contains:

	CHILDKILLED <pid> <signal name> <signal description>
e.g.:
	CHILDKILLED 21105 SIGTERM {software termination signal}

This is on Linux; I don't know about Windows.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list