async function runCommand(options) {
  if (!Number.isInteger(options.port) || options.port < 0 || options.port > 65536) {
    const simpleArgv = yargsParser(process.argv.slice(2), {envPrefix: 'LHCI'});
    const environment = Object.keys(process.env)
      .filter(key => key.startsWith('LHCI_'))
      .map(key => `${key}="${process.env[key]}"`)
      .sort()
      .join(', ');
    process.stderr.write(`Invalid port option "${options.port}"\n`);
    process.stderr.write(`environment: ${environment}\n`);
    process.stderr.write(`process.argv: ${process.argv.slice(2).join(' ')}\n`);
    process.stderr.write(`simpleArgv: port=${simpleArgv.port}, p=${simpleArgv.p}\n`);
    process.stderr.write(`configFile: ${resolveRcFilePath(simpleArgv.config)}\n`);
    process.exit(1);
  }

  // Require this only after they decide to run `lhci server`
  // eslint-disable-next-line import/no-extraneous-dependencies
  const {createServer} = require('@lhci/server');
  return createServer(options);
}
@param {LHCI.ServerCommand.Options} options
@return {Promise<{port: number, close: () => void}>}