Ensure exitStatus is a number, or null.

We really want exitStatus to be an integer, but in case we couldn't get
the status at all, we need a null status as well.
Move logic of judge executable into a function.