Check exit code from dup() in spawn() and log error if it fail.