final public static async function runAsync()

in src/CLIBase.hack [172:197]


  final public static async function runAsync(): Awaitable<int> {
    $in = IO\request_input();
    $out = IO\request_output();
    $err = IO\request_error() ?? $out;
    try {
      $responder = new static(
        vec(/* HH_FIXME[4110] */ \HH\global_get('argv')),
        new Terminal($in, $out, $err),
      );
      return await $responder->mainAsync();
    } catch (ExitException $e) {
      $code = $e->getCode();
      $message = $e->getUserMessage();
      if ($message !== null) {
        if ($code === 0) {
          await $out->writeAllAsync($message."\n");
        } else {
          await $err->writeAllAsync($message."\n");
        }
      }
      return $code;
    } catch (CLIException $e) {
      await $err->writeAllAsync($e->getMessage()."\n");
      return 1;
    }
  }