[GRASS-user] return value of modules?

Hamish hamish_b at yahoo.com
Fri Sep 19 05:42:23 EDT 2008


Rainer Krug wrote:
> do the modules of R (e.g. r.stats, ...) have return values
> which I can evaluate to find out if the execution was successful?

Yes. GRASS modules all return 0 on success and 1 on failure.


> I would like to use these "return values on error" to evaluate the
> success of the command when called from R.

In most cases you can trust that method. Maybe 1% of modules use a
different failure code, if so it's a bug & please report it.


Some/many of the internal C functions will use 1 as success, but they
will typically be called G_is_something() and return a boolean result.
The lib fns return all sorts of things, always check before using them.


Hamish



      



More information about the grass-user mailing list