[gmx-developers] exit codes

Mark Abraham Mark.Abraham at anu.edu.au
Tue Jul 21 04:18:31 CEST 2009


Justin MacCallum wrote:
> Hi All,
> 
> I'm writing some scripts to automate setting up and running gromacs 
> simulations and I have run into the minor problem in that sometimes the 
> gromacs tools do not give a useful exit code. For example, calling any 
> of the tools with an option that they don't understand (e.g. "editconf 
> -xxxxx ...")  gives a return code of zero. I haven't checked thoroughly 
> to see in what situations the exit code is set, but ideally the command 
> line tools should have an exit code of zero if everything completed 
> successfully and non-zero if something went wrong. Checking the exit 
> code is much simpler than trying to search for error strings in the 
> standard output.

I get 255 from "editconf -xdfxf ; echo $?" which seems right. If you are 
running with -debug, then you may be falling foul of an abort() call in 
quit_gmx().

> I looked at the code, but I'm not very familiar with gromacs internals 
> and I couldn't figure out why this wasn't working correctly. This is 
> with the latest git running on OS X 10.5. I'm using subprocess.Popen in 
> python to execute the gromacs tools.

The regularization is all done by parse_common_args in 
src/gmxlib/statutil.c and it calls get_pargs in src/gmxlib/pargs.c.

Mark



More information about the gromacs.org_gmx-developers mailing list