sven-lange-last commented on a change in pull request #4070: Diagnostic info + metrics for Docker command failures and timeouts URL: https://github.com/apache/incubator-openwhisk/pull/4070#discussion_r227849548
########## File path: core/invoker/src/main/scala/whisk/core/containerpool/docker/ProcessRunner.scala ########## @@ -52,17 +52,75 @@ trait ProcessRunner { case _ => None } - (process.exitValue(), out.mkString("\n"), err.mkString("\n"), scheduled) + (ExitStatus(process.exitValue()), out.mkString("\n"), err.mkString("\n"), scheduled) }).flatMap { - case (0, stdout, _, scheduled) => + case (ExitStatus(0), stdout, _, scheduled) => scheduled.foreach(_.cancel()) Future.successful(stdout) - case (code, stdout, stderr, scheduled) => + case (exitStatus, stdout, stderr, scheduled) => scheduled.foreach(_.cancel()) - Future.failed(ProcessRunningException(code, stdout, stderr)) + timeout match { + case t: FiniteDuration if exitStatus.terminatedBySIGTERM => + Future.failed(ProcessTimeoutException(timeout, exitStatus, stdout, stderr)) + case _ => Future.failed(ProcessRunningException(exitStatus, stdout, stderr)) + } } +} + +case class ExitStatus(statusValue: Int) { + + // Based on The Open Group Base Specifications Issue 7, 2018 edition: + // Shell & Utilities - Shell Command Language - 2.8.2 Exit Status for Commands + // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02 + val STATUS_SUCCESSFULL = 0 Review comment: Done. Why did you suggest the change - just for style / coding convention reasons or are there additional reasons? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services