basic-lib/src/main/java/com/streamsets/pipeline/stage/executor/shell/ShellExecutor.java
private static int retrievePidIfFeasible(Process process) {
    if(unixProcessClass == null) {
      return UNDETERMINED_PID;
    }

    if(!unixProcessClass.isInstance(process)) {
      LOG.debug("Do not support retrieving PID from {}", process.getClass().getName());
      return UNDETERMINED_PID;
    }

    try {
      return (int)pidField.get(process);
    } catch (IllegalAccessException e) {
      LOG.debug("Can't retrieve PID value from the field", e);
      return UNDETERMINED_PID;
    }

  }
private static int retrievePidIfFeasible(Process process) {
    if(unixProcessClass == null) {
      return UNDETERMINED_PID;
    }

    if(!unixProcessClass.isInstance(process)) {
      LOG.debug("Do not support retrieving PID from {}", process.getClass().getName());
      return UNDETERMINED_PID;
    }

    try {
      return (int)pidField.get(process);
    } catch (IllegalAccessException e) {
      LOG.debug("Can't retrieve PID value from the field", e);
      return UNDETERMINED_PID;
    }

  }
Attempts to retrieve PID from internal JVM classes. This method is not guaranteed to work as JVM is free
to change their implementation at will. Hence the return value should be only used for troubleshooting or
debug and not for main functionality.