docs: public static Thread addShutdownHook(final Process process) {
          final Thread thread = new Thread(new Runnable() {
              @Override
              public void run() {
                  if (process != null) {
                      process.destroy();
                      try {
                          process.waitFor();
                      } catch (InterruptedException e) {
                          throw new RuntimeException(e);
                      }
                  }
              }
          });
          thread.setDaemon(true);
          Runtime.getRuntime().addShutdownHook(thread);
          return thread;
      }