Currently, if a PHP script calls exit(), not only does the script terminate, but also the GO binary running it - see #31. This pull request changes this in a backwards-compatible way* such that calls to Exec() and Eval() will return an error which can be checked for.
Example
val, err := context.Eval(script);
if err != nil {
if exit, ok := err.(*php.ExitError); ok {
fmt.Printf("PHP exited with exit status %d\n", exit.Status)
} else {
fmt.Printf("Could not execute script %s: %v", script, err)
}
}
*: ...instead of changing the return types, or introducing any global state in context, or adding new methods. The API is modeled a bit after os/exec
Currently, if a PHP script calls
exit()
, not only does the script terminate, but also the GO binary running it - see #31. This pull request changes this in a backwards-compatible way*
such that calls toExec()
andEval()
will return an error which can be checked for.Example
*
: ...instead of changing the return types, or introducing any global state in context, or adding new methods. The API is modeled a bit after os/exec