@ApiStatus.Internal
  public static void scheduleRestart(boolean elevate, String @NotNull ... beforeRestart) throws IOException {
    var exitCodeVariable = EnvironmentUtil.getValue(SPECIAL_EXIT_CODE_FOR_RESTART_ENV_VAR);
    if (exitCodeVariable != null) {
      if (beforeRestart.length > 0) {
        throw new IOException("Cannot restart application: specific exit code restart mode does not support executing additional commands");
      }
      try {
        System.exit(Integer.parseInt(exitCodeVariable));
      }
      catch (NumberFormatException ex) {
        throw new IOException("Cannot restart application: can't parse required exit code", ex);
      }
    }
    else if (SystemInfo.isWindows) {
      restartOnWindows(elevate, List.of(beforeRestart), mainAppArgs);
    }
    else if (SystemInfo.isMac) {
      restartOnMac(List.of(beforeRestart), mainAppArgs);
    }
    else if (SystemInfo.isLinux) {
      restartOnLinux(List.of(beforeRestart), mainAppArgs);
    }
    else {
      throw new IOException("Cannot restart application: not supported.");
    }
  }
@ApiStatus.Internal
  public static void scheduleRestart(boolean elevate, String @NotNull ... beforeRestart)