protected function invokeHook($hook) {
    if ($this->getConfig()->has("command-hooks.$hook.command")
      && $this->getConfigValue("command-hooks.$hook.command")) {
      $this->say("Executing $hook target hook...");
      $result = $this->taskExecStack()
        ->exec($this->getConfigValue("command-hooks.$hook.command"))
        ->dir($this->getConfigValue("command-hooks.$hook.dir"))
        ->interactive($this->input()->isInteractive())
        ->printOutput(TRUE)
        ->printMetadata(TRUE)
        ->stopOnFail()
        ->run();

      if (!$result->wasSuccessful()) {
        throw new BltException("Executing target-hook $hook failed.");
      }
    }
    else {
      $this->logger->info("Skipped $hook target hook. No hook is defined.");

      return 0;
    }
  }