INNER CODE UNIT · Python

watch

pasteurlabs/tesseract-core · tesseract_core/runtime/cli.py:533

    def watch() -> None:
        try:
            while os.read(fd, 1):
                # Nothing is expected to be written; a stray byte is not EOF.
                pass
        except OSError:
            pass
        # Ask uvicorn to stop rather than dying where we stand, so workers are
        # shut down and the port is released.
        os.kill(os.getpid(), signal.SIGTERM)

    threading.Thread(target=watch, daemon=True, name="parent-watch").start()


@app.command("serve")
def serve(
    host: Annotated[str, typer.Option(help="Host IP address")] = "127.0.0.1",
    port: Annotated[int, typer.Option(help="Port number")] = 8000,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…