Releases: watchexec/watchexec
CLI v2.1.1
- Regression:
-w, --watch
was accidentally set to behave as-W
(#828)
CLI v2.1.0
- New:
-W
,--watch-non-recursive
for watching paths without also watching subfolders. - New: out-of-tree git repositories are now detected (i.e. when
.git
is a file rather than a folder) - Logs are also improved slightly with less nonsense at startup.
CLI v2.0.0
This is the first breaking release. Most of it is cleaning up a number of deprecated options, and changing some defaults. The idea, however, is to start a new era of Watchexec releases, where breaking changes are allowed more easily (to give an idea of how breaking-change-averse the project has been: this release was planned in January 2022! and ever-delayed since).
Fear not! The cadence of breaking releases will be at most once or twice a year, and whenever possible a deprecation will precede a break by at least three months. Watchexec will remain a stable part of your workflow, while allowing ourselves some evolution.
- Shell default changes to
$SHELL
when it is present. (#210)
Use--shell=sh
to switch back if your$SHELL
is something else. - Shell default changes to Powershell on Windows when Watchexec detects it is running in Powershell. (#80)
Use--shell=cmd
to switch back to CMD.EXE, or set theSHELL
environment variable.
A reminder that Windows 7 is not supported, and hasn't been for years. --on-busy-update
defaults todo-nothing
now (wasqueue
).
Events received while a command is running won't trigger a run of the command immediately following this one.-W
/--watch-when-idle
is removed, as it is now the default.- The default for
--stop-timeout
is now 10 seconds. --debounce
,--delay-run
,--poll
, and--stop-timeout
now prefer durations with a unit, and warn if given unit-less durations. The default units for these are millisecond for--debounce
and--poll
, and seconds for--delay-run
and--stop-timeout
, which is a source of confusion. Unit-less durations will be removed in a future breaking release.--no-shell
is removed.
Use--shell=none
instead. The-n
short option remains as an alias to--shell=none
.-k
/--kill
is removed.
Use--signal=KILL
instead.--changes-only
is removed.
Use--print-events
instead.--emit-events-to
defaults tonone
, and theenvironment
mode is deprecated.--emit-events-to
no longer acceptsstdin
(deprecated alias forstdio
) andjson-stdin
(deprecated alias forjson-stdio
).--no-ignore
is removed.
Use--no-project-ignore
instead.--no-environment
is deprecated.--clear=reset
will reset the screen on graceful shutdown. (#797)--no-process-group
is deprecated.- Watchexec no longer warns (nor does anything else) when it sees the deprecated
WATCHEXEC_FILTERER
environment variable.
Improvements
- New:
--wrap-process=MODE
lets you choose between using process groups, process sessions, or nothing at all. (#794) - New: the
WATCHEXEC_TMPDIR
environment variable can be used to customize where Watchexec will write temporary files, if for some reason your$TMPDIR
is unwritable. (#814) - Fix: watchexec no longer creates a temporary file at startup. (#814)
- Fix: the screen is no longer cleared on all events, only when starting a new process. (#809)
Experimental new feature
As a treat, this release also features an experimental new option: -j
or --filter-prog
, which lets you write filter programs.
-j
, --filter-prog EXPRESSION
Provide your own custom filter programs in jaq (similar to jq) syntax. Programs are given an event in the same format as described in --emit-events-to
and must return a boolean. In addition to the jaq stdlib, watchexec adds some custom filter definitions:
path | file_meta
returns file metadata or null if the file does not exist.path | file_size
returns the size of the file at path, or null if it does not exist.path | file_read(bytes)
returns a string with the first n bytes of the file at path. If the file is smaller than n bytes, the whole file is returned. There is no filter to read the whole file at once to encourage limiting the amount of data read and processed.string | hash
, andpath | file_hash
return the hash of the string or file at path. No guarantee is made about the algorithm used: treat it as an opaque value.any | kv_store(key)
,kv_fetch(key)
, andkv_clear
provide a simple key-value store. Data is kept in memory only, there is no persistence. Consistency is not guaranteed.any | printout
,any | printerr
, andany | log(level)
will print or log any given value to stdout, stderr, or the log (levels = error, warn, info, debug, trace), and pass the value through (so[1] | log("debug") | .[]
will produce a1
and log[1]
).
All filtering done with such programs, and especially those using kv or filesystem access, is much slower than the other filtering methods. If filtering is too slow, events will back up and stall watchexec. Take care when designing your filters.
If the argument to this option starts with an '@', the rest of the argument is taken to be the path to a file containing a jaq program.
Jaq programs are run in order, after all other filters, and short-circuit: if a filter (jaq or not) rejects an event, execution stops there, and no other filters are run. Additionally, they stop after outputting the first value, so you'll want to use 'any' or 'all' when iterating, otherwise only the first item will be processed, which can be quite confusing!
Examples:
Regexp ignore filter on paths:
all(.tags[] | select(.kind == "path"); .absolute | test("[.]test[.]js$")) | not
Pass any event that creates a file:
any(.tags[] | select(.kind == "fs"); .simple == "create")
Pass events that touch executable files:
any(.tags[] | select(.kind == "path" && .filetype == "file"); .absolute | metadata | .executable)
Ignore files that start with shebangs:
any(.tags[] | select(.kind == "path" && .filetype == "file"); .absolute | read(2) == "#!") | not
More examples can be found and contributed in the discussion thread
CLI v1.25.1
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
In this release:
- Fix compatibility with 32-bit platforms (#730)
- Fix bugs introduced by inconsistent path normalisation in optimised ignore handling (#759)
Known issue:
- On MacOS, you might see "No such file or directory (os error 2)". This is being investigated, this issue has a workaround or downgrade to 1.24.
CLI v1.25.0
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
In this release:
- Startup performance improvements reducing the amount of directories visited when discovering ignore files. (#663 by @t3hmrman)
- Improvements to handling of nested ignore files. (#745 by @thislooksfun)
Other changes:
- Project origin detection tweaked a little to avoid some false positives. (#748)
CLI v1.24.2
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
In this release:
Other changes:
CLI v1.24.1
Software development often involves running the same commands over and over. Boring! Watchexec is a standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
In this release:
CLI v1.24.0
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
In this release:
- New: start/stop messages are now in colour. Use
--colour=never
(--color
also accepted) to disable, or the conventionalalways
andauto
. (#144, #237, #698) - New:
--timings
to print how long the command took. (#278, #698) - New:
--quiet
to disable printing any message (except warning and error logs). (#698) - New:
--bell
to ring the terminal bell on command end. (#238, #698) - New:
--ignore-nothing
to switch on all the--no-*-ignore
flags. (#275, #625, #695) - New:
--only-emit-events
disables launching a command, and only prints events to stdout. Requires--emit-events-to
to specify the format to print. This lets you obtain a stream of change events to handle directly rather than mediating via a command. (#676, #691) - New:
--map-signal
to map signals received by Watchexec to other signals sent to the command. (#151, #387, #710) - Change:
--emit-events-to
stdin
andjson-stdin
modes are renamed tostdio
andjson-stdio
respectively; the old names are aliased to preserve compatibility.
Other changes:
- Uses the Watchexec library 3.0. (#601)
-w /dev/null
disables watching any files. This is the literal string/dev/null
, it won't detect the null device via links or fifos. (#601)- Running as PID1 (e.g. in Docker) is fully supported. (#140, #601, #624)
- Performance improvements and bugfixes around reaping processes (via
command-group
5). (#601) - Performance improvements and bugfixes around watching files (via
notify
6). (#601) - Clear the screen before printing events, so
--print-events
and--clear
can meaningfully be used together. (#601) - Hint that more or less help is available with long
--help
and short-h
flags. (#601) - The PDF version of the manual page is gone, due to the tooling I used disappearing, and the general ugliness of its typesetting. (#710)
CLI v1.23.0
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.
In this release:
- Don't search for project, global ignores when
--no-project-ignore
,--no-global-ignore
are given respectively (#644, #643) - Add
--no-discover-ignore
which implies--no-project-ignore
,--no-global-ignore
, and--no-vcs-ignore
and completely disables ignore discovery — useful on very large repos (#645)
Other changes:
CLI v1.22.3
Software development often involves running the same commands over and over. Boring! Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. Install it today with cargo-binstall watchexec-cli
, from the binaries below, find it in your favourite package manager, or build it from source with cargo install watchexec-cli
.