[Nix-dev] eval $buildPhase and exit code in case of syntax error

Marc Weber marco-oweber at gmx.de
Fri Oct 17 00:22:55 CEST 2008


I've spend a some time today debugging a mistake..
I didn't see a syntax error within my phase :-(

The problem:

eval "{" returns exit code 0 !

fail || eval "{" does so as well.

The only solution to make this a failure I've found is doing something
awkward such as:

myEval(){
        local evalSucc="failure"
        eval "evalSucc=ok;""$1"
        [ $evalSucc = "failure" ] && return 1
}

So does someone mind me replacing the eval found in setup-new by this
one?
Is there a good point in time to add this because it would cause rebuild
of everything..

Do we have setup-new to add where I can add it?

Maybe defining this is even better:

eval(){
  e="$(type eval | { read; while read line; do echo $line; done })"
  unset eval; 
  local evalSucc="failure"
  eval "evalSucc=ok;""$1"
  eval "$e"
  [ $evalSucc = "failure" ] && return 1
}

Sincerly
Marc Weber



More information about the nix-dev mailing list