Source:
@Override protected Integer exitStatus(FilePath workspace, TaskListener listener) throws IOException, InterruptedException { Integer status = null; OsType os = workspace.act(new getOsType()); if(os == OsType.ZOS) { FilePath statusFile = getResultFile(workspace); status = statusFile.act(new StatusCheckWithEncoding(getCharset())); } else { status = super.exitStatus(workspace, listener); } if (status != null) { LOGGER.log(Level.FINE, "found exit code {0} in {1}", new Object[] {status, controlDir}); return status; } long now = System.nanoTime(); if (lastCheck == 0) { LOGGER.log(Level.FINE, "starting check in {0}", controlDir); lastCheck = now; } else if (now > lastCheck + TimeUnit.SECONDS.toNanos(HEARTBEAT_CHECK_INTERVAL)) { lastCheck = now; long currentTimestamp = getLogFile(workspace).lastModified(); if (currentTimestamp == 0) { listener.getLogger().println("process apparently never started in " + controlDir); return recordExitStatus(workspace, -2); } else if (checkedTimestamp > 0) { if (currentTimestamp < checkedTimestamp) { listener.getLogger().println("apparent clock skew in " + controlDir); } else if (currentTimestamp < checkedTimestamp + TimeUnit.SECONDS.toMillis(HEARTBEAT_MINIMUM_DELTA)) { FilePath pidFile = pidFile(workspace); if (pidFile.exists()) { listener.getLogger().println("still have " + pidFile + " so heartbeat checks unreliable; process may or may not be alive"); } else { listener.getLogger().println("wrapper script does not seem to be touching the log file in " + controlDir); listener.getLogger().println("(JENKINS-48300: if on an extremely laggy filesystem, consider -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400)"); return recordExitStatus(workspace, -1); } } } else { LOGGER.log(Level.FINE, "seeing recent log file modifications in {0}", controlDir); } checkedTimestamp = currentTimestamp; } return null; }

Target:
@Override protected Integer exitStatus(FilePath workspace, TaskListener listener) throws IOException, InterruptedException { Integer status; if(isZos) { FilePath statusFile = getResultFile(workspace); status = statusFile.act(new StatusCheckWithEncoding(getCharset())); } else { status = super.exitStatus(workspace, listener); } if (status != null) { LOGGER.log(Level.FINE, "found exit code {0} in {1}", new Object[] {status, controlDir}); return status; } long now = System.nanoTime(); if (lastCheck == 0) { LOGGER.log(Level.FINE, "starting check in {0}", controlDir); lastCheck = now; } else if (now > lastCheck + TimeUnit.SECONDS.toNanos(HEARTBEAT_CHECK_INTERVAL)) { lastCheck = now; long currentTimestamp = getLogFile(workspace).lastModified(); if (currentTimestamp == 0) { listener.getLogger().println("process apparently never started in " + controlDir); return recordExitStatus(workspace, -2); } else if (checkedTimestamp > 0) { if (currentTimestamp < checkedTimestamp) { listener.getLogger().println("apparent clock skew in " + controlDir); } else if (currentTimestamp < checkedTimestamp + TimeUnit.SECONDS.toMillis(HEARTBEAT_MINIMUM_DELTA)) { FilePath pidFile = pidFile(workspace); if (pidFile.exists()) { listener.getLogger().println("still have " + pidFile + " so heartbeat checks unreliable; process may or may not be alive"); } else { listener.getLogger().println("wrapper script does not seem to be touching the log file in " + controlDir); listener.getLogger().println("(JENKINS-48300: if on an extremely laggy filesystem, consider -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400)"); return recordExitStatus(workspace, -1); } } } else { LOGGER.log(Level.FINE, "seeing recent log file modifications in {0}", controlDir); } checkedTimestamp = currentTimestamp; } return null; }