code: public static void checkExit(ProcessAttributes attributes, ProcessResult result) {
      Set<Integer> allowedExitValues = attributes.getAllowedExitValues();
      if (allowedExitValues != null && !allowedExitValues.contains(result.getExitValue())) {
        StringBuilder sb = new StringBuilder();
        sb.append("Unexpected exit value: ").append(result.getExitValue());
        sb.append(", allowed exit values: ").append(allowedExitValues);
        addExceptionMessageSuffix(attributes, sb, result.hasOutput() ? result.getOutput() : null);
        throw new InvalidExitValueException(sb.toString(), result);
      }
    }
docs: Check the process exit value.