aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pw_watch/docs.rst4
-rwxr-xr-xpw_watch/py/pw_watch/watch.py9
2 files changed, 8 insertions, 5 deletions
diff --git a/pw_watch/docs.rst b/pw_watch/docs.rst
index 6e0824a8f..ad4def6bb 100644
--- a/pw_watch/docs.rst
+++ b/pw_watch/docs.rst
@@ -50,7 +50,9 @@ patterns. These patterns do not override Git's ignoring logic.
The ``--exclude_list`` argument can be used to exclude directories from being
watched. This decreases the number of files monitored with inotify in Linux.
-While running ``pw watch``, press enter to immediately trigger a rebuild.
+By default, ``pw watch`` automatically restarts an ongoing build when files
+change. This can be disabled with the ``--no-restart`` option. While running
+``pw watch``, you may also press enter to immediately restart a build.
Unit Test Integration
=====================
diff --git a/pw_watch/py/pw_watch/watch.py b/pw_watch/py/pw_watch/watch.py
index 30d221ff3..c7269e7f9 100755
--- a/pw_watch/py/pw_watch/watch.py
+++ b/pw_watch/py/pw_watch/watch.py
@@ -141,7 +141,7 @@ class PigweedBuildWatcher(FileSystemEventHandler, DebouncedFunction):
ignore_patterns: Sequence[str] = (),
build_commands: Sequence[BuildCommand] = (),
charset: WatchCharset = _ASCII_CHARSET,
- restart: bool = False,
+ restart: bool = True,
):
super().__init__()
@@ -350,9 +350,10 @@ def add_parser_arguments(parser: argparse.ArgumentParser) -> None:
type=Path,
help='directories to ignore during pw watch',
default=[])
- parser.add_argument('--restart',
- action='store_true',
- help='restart an ongoing build if files change')
+ parser.add_argument('--no-restart',
+ dest='restart',
+ action='store_false',
+ help='do not restart ongoing builds if files change')
parser.add_argument(
'default_build_targets',
nargs='*',