Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] persistent_save function being used in stable spells?

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Andrew <afrayedknot AT thefrayedknot.armory.com>
  • To: SM-Discuss <sm-discuss AT lists.ibiblio.org>
  • Subject: Re: [SM-Discuss] persistent_save function being used in stable spells?
  • Date: Sun, 18 Apr 2004 09:47:19 -0700


On Sun, Apr 18, 2004 at 10:37:07AM +0200, Vladim?r Marek wrote:
> > Hmm, also I had meant to point out that one of the reasons why sorcery is
> > not detecting failures is due to structures like this:
> > if [ -x BUILD ] ; then
> > persistant_load
> > . BUILD
> > persistant_save
> > else
> > default_build
> > fi &&
>
> I can see another danger there, in the
>
> persistant_load
> . BUILD
> persistant_save
>
> itself. If the BUILD fails, persistant_save is going to carry out the
> return also. There are two solutions I can see:
>
> a)
> persistant_load
> . BUILD && persistant_save
>
> b)
> persistant_save will maintain return value from last function:
> function persistant_save () {
> local RET=$?
>
> ....
>
> return $RET
> }

what im doing is:
persistant_load &&
if [ -x BUILD ] ; then
. BUILD
else
default_build
fi &&
persistant_save &&
...

May bash-fu is weak but that seems to get around the problem and lets
the user redefine variables inside default_build as well.

-Andrew

--
__________________________________________________________________________
|Andrew D. Stitt | astitt at sourcemage.org |
|irc: afrayedknot | afrayedknot at t.armory.com |
|aim: thefrayedknot or iteratorplusplus | |
|Sorcery Team Lead, Porting Team Lead | |
|Grimoire Guru ham/smgl | ftp://t.armory.com |
|Author and Maintainer of Prometheus | |
--------------------------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page