$? == -1 means the system call to launch the command failed. The error code/msg is in $!.
In reply to Re: $? stuck returning -1... by ikegami in thread $? stuck returning -1... by cmv