public void launch(Monitored mp) {
    if (!lifecycle.tryToMoveTo(Lifecycle.State.STARTING)) {
      throw new IllegalStateException("Already started");
    }
    monitored = mp;

    Logger logger = LoggerFactory.getLogger(getClass());
    try {
      launch(logger);
    } catch (Exception e) {
      logger.warn("Fail to start {}", processId.getHumanReadableName(), e);
      hardStop();
    }
  }
@Test
  public void terminate_if_startup_error() throws IOException {
    Props props = createProps();
    final ProcessEntryPoint entryPoint = new ProcessEntryPoint(props, exit, commands, runtime);
    final Monitored process = mock(Monitored.class);
    doThrow(IllegalStateException.class).when(process).start();

    entryPoint.launch(process);
  }