code: private Thread createShutdownHook(final Process process) {
          final Pipe errPipe = new Pipe(process.getErrorStream(), System.err).start("Error pipe");
          final Pipe outPipe = new Pipe(process.getInputStream(), System.out).start("Out pipe");
          final Pipe inPipe = new Pipe(process.getOutputStream(), System.in).start("In pipe");
  
          return new Thread(new Runnable() {
  
              @Override
              public void run() {
                  inPipe.stop();
                  outPipe.stop();
                  errPipe.stop();
  
                  try {
                      process.destroy();
                  }
                  // CHECKSTYLE:SKIP
                  catch (Exception e) {
                      // ignore if already shutting down
                  }
              }
          }, "Pax-Runner shutdown hook");
      }
docs: Create helper thread to safely shutdown the external framework process
  
  @param process
  framework process
  @return stream handler