def script():
    # Setup logging
    import logging
    logging.basicConfig(
        format="%(levelname)s: %(message)s",
        datefmt="%Y-%m-%d %H:%M:%S",
        stream=sys.stdout)
    logger = logging.getLogger()

    # Dispatch to the command according to the script name
    script = sys.argv[0]
    args = sys.argv[1:]
    if os.path.basename(script).startswith('pgxn-'):
        args.insert(0, os.path.basename(script)[5:])
        # for help print
        sys.argv[0] = os.path.join(os.path.dirname(script), 'pgxn')

    # Execute the script
    try:
        main(args)

    # Different ways to fail
    except UserAbort, e:
        # The user replied "no" to some question
        logger.info("%s", e)
        sys.exit(1)

    except PgxnException, e:
        # An regular error from the program
        logger.error("%s", e)
        sys.exit(1)

    except SystemExit, e:
        # Usually the arg parser bailing out.
        pass

    except Exception, e:
        logger.error(_("unexpected error: %s - %s"),
            e.__class__.__name__, e, exc_info=True)
        sys.exit(1)

    except BaseException, e:
        # ctrl-c
        sys.exit(1)
Returns the `fileno()` of the reader end of the Pump.
dataset/ETHPy150Open dvarrazzo/pgxnclient/pgxnclient/cli.py/script--crossover with--dataset/ETHPy150Open d11wtq/dockerpty/dockerpty/io.py/Pump.fileno