CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   pyFoam: Why no non-zero return codes? (http://www.cfd-online.com/Forums/openfoam/101575-pyfoam-why-no-non-zero-return-codes.html)

Horus May 8, 2012 04:55

pyFoam: Why no non-zero return codes?
 
Hello,

I'm wondering why some (all?) pyFoam tools do not return a non-zero return code if the openfoam tool fails.

For example:

pyFoamRunner.py --autosense-parallel potentialFoam -noFunctionObjects

fails because there is some dictionary entry missing, the return code is 0.

mpirun -n 2 potentialFoam -noFunctionObjects

fails too, but with a return code of 1.

Same for pyFoamRunner.py.

Returning non-zero exit code to indicate an error makes it much easier for scripts to use pyFoam.

Any reason for this design decision or just not implemented yet?

Regards,

Florian

gschaider May 8, 2012 06:49

Quote:

Originally Posted by Horus (Post 359876)
Hello,

I'm wondering why some (all?) pyFoam tools do not return a non-zero return code if the openfoam tool fails.

For example:

pyFoamRunner.py --autosense-parallel potentialFoam -noFunctionObjects

fails because there is some dictionary entry missing, the return code is 0.

mpirun -n 2 potentialFoam -noFunctionObjects

fails too, but with a return code of 1.

Same for pyFoamRunner.py.

Returning non-zero exit code to indicate an error makes it much easier for scripts to use pyFoam.

Any reason for this design decision or just not implemented yet?

Regards,

Florian

Reasons are:

- I didn't need it yet (I don't check return codes in shell-scripts. If that is necessary I use Python)
- there was no feature-request on the Mantis yet

So this is NO design decision

Horus May 8, 2012 10:05

Ok, the bugtracker is offline at the moment, I will file a request later and will also have a look at the code and see if I can produce a patch.

gschaider May 8, 2012 10:25

Quote:

Originally Posted by Horus (Post 359947)
Ok, the bugtracker is offline at the moment, I will file a request later and

OK. I admit it. I hacked them so that this request would not come through

Quote:

Originally Posted by Horus (Post 359947)
will also have a look at the code and see if I can produce a patch.

Oh. Great. Under these circumstances I will allow sourceforge to continue with its operations

;)


All times are GMT -4. The time now is 08:03.