Fix --reload interpreting 'serve' command as a file argument (#2646)

When hupper spawns the worker process, it calls the function specified by
worker_path directly. Using "datasette.cli.serve" causes Click to parse
sys.argv without going through the CLI group, so the literal word "serve"
from the original command gets treated as a positional file argument.

Change the worker path to "datasette.cli.cli" so the worker process goes
through the Click group dispatcher, which properly recognizes "serve" as
a subcommand and strips it from the argument list.

Closes #2123

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
Daniel Bates 2026-02-25 16:46:29 -08:00 committed by GitHub
commit 2bc1dd2275
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -547,7 +547,7 @@ def serve(
if reload:
import hupper
reloader = hupper.start_reloader("datasette.cli.serve")
reloader = hupper.start_reloader("datasette.cli.cli")
if immutable:
reloader.watch_files(immutable)
if config: