Application exit code to reflect actor system shutdown cause

What is the best way to have application exit code reflect actor system shutdown cause? The code below reflects the idea, but does not work (it’s always Success(Done)).

sealed trait AppProtocol
val appDef = setup[AppProtocol] { ctx =>
  ...
}

ActorSystem(appDef, "app", config).whenTerminated.onComplete {
  case Success(Done) =>
    sys.exit()
  case Failure(cause) =>
    logger.error(s"actor system critical error: ${cause.getMessage}", cause)
    sys.exit(1)
}

Coordinated shutdown has a akka.actor.CoordinatedShutdown.Reason that can be/is passed when shutting down, and at the end of shutdown, if terminating the JVM is enabled, there is a default system exit code that can be overridden for each specific Reason in config: akka/reference.conf at main · akka/akka · GitHub