Exec() return code 1

Evenin’,

I’m trying to run a command through exec():


$command = "msgmerge --backup=off -U $po $potfile";
exec($command, $output, $return);

The arguments $po and $potfile are escaped, the command works on command line and often through exec too. But sometimes $return contains 1. I have no idea what that means.

I always thought that $return==0 is good in this case, $return!=0 is bad.
I’ve searched high and low, but I cannot find what return code 1 means.

So… what does return code 1 mean from exec()?

Thanks! :slight_smile:

Exec is returning the exit status of msgmerge. That value can be anything from 0–255 0 being success everything else errors.

http://www.faqs.org/docs/abs/HTML/exit-status.html

Thanks for the link! I read this:

Reserved Exit Codes:
1 - catchall for general errors
e.g. let “var1 = 1/0”
miscellaneous errors, such as “divide by zero”

Nice. back to debugging :slight_smile:

Update.

I think it had something to do with permissions.
I ended up deleting all the .po, .mo and .pot files I had and generating everything from a fresh/ clean situation. Of course, it worked perfectly this time and it’s not returning error code 1 anymore. >.<