Skip to content

Commit

Permalink
fix docs and return the exit code from run_once()
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerickel committed Apr 2, 2023
1 parent 7cd636b commit 3bc2fdc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hupper/reloader.py
Expand Up @@ -133,8 +133,9 @@ def run(self):
"""
Execute the reloader forever, blocking the current thread.
This will invoke ``sys.exit(1)`` if interrupted and
the process didn't handle the interrupt gracefully.
This will invoke ``sys.exit`` with the return code from the
subprocess. If interrupted before the process starts then
it'll exit with ``-1``.
"""
exitcode = -1
Expand All @@ -159,9 +160,12 @@ def run_once(self):
This method will return after the worker exits.
Returns the exit code from the worker process.
"""
with self._setup_runtime():
self._run_worker()
_, exitcode = self._run_worker()
return exitcode

def _run_worker(self):
worker = Worker(
Expand Down

0 comments on commit 3bc2fdc

Please sign in to comment.