Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: watchexec-cli v1.24.0 #699

Merged
merged 23 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-pr.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ cargo publish -p <%= crate.name %>
```
<% } %>

To trigger builds initially: either close and then immediately re-open this PR once, or **enable auto-merge**.
To trigger builds initially: either close and then immediately re-open this PR once, or push to the branch (perhaps with edits to the README.md or CHANGELOG.md!).

<% if (pr.releaseNotes) { %>
---
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ inputs.version }}
crate-path: crates/${{ inputs.crate }}
pr-release-notes: true
pr-release-notes: ${{ inputs.crate == 'cli' }}
pr-label: release
pr-template-file: .github/workflows/release-pr.ejs
env:
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ jobs:
- name: Check that CLI runs
run: cargo run ${{ env.flags }} -p watchexec-cli -- -1 echo

- name: Install coreutils on mac
if: ${{ matrix.platform == 'macos' }}
run: brew install coreutils

- name: Run watchexec integration tests (unix)
if: ${{ matrix.platform != 'windows' }}
run: crates/cli/run-tests.sh
shell: bash
env:
WATCHEXEC_BIN: target/debug/watchexec

- name: Run bosion integration tests
run: ./run-tests.sh
working-directory: crates/bosion
Expand Down Expand Up @@ -122,15 +133,14 @@ jobs:
- run: cross check --target x86_64-unknown-freebsd
- run: cross check --target x86_64-unknown-netbsd

# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
if: always() # always run even if dependencies fail
if: always()
name: Tests pass
needs:
- test
- cross-checks
runs-on: ubuntu-latest
steps:
# fail if ANY dependency has failed or been skipped or cancelled
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')"
run: exit 1
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ message: |
If you use this software, please cite it using these metadata.
title: "Watchexec: a tool to react to filesystem changes, and a crate ecosystem to power it"

version: "1.23.0"
date-released: 2023-08-30
version: "1.24.0"
date-released: 2023-12-09

repository-code: https://github.com/watchexec/watchexec
license: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "watchexec-cli"
version = "1.23.0"
version = "1.24.0"

authors = ["Félix Saparelli <felix@passcod.name>", "Matt Green <mattgreenrocks@gmail.com>"]
license = "Apache-2.0"
Expand Down
7 changes: 7 additions & 0 deletions crates/cli/integration/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -euxo pipefail

watchexec=${WATCHEXEC_BIN:-watchexec}

$watchexec -1 --env FOO=BAR echo '$FOO' | grep BAR
7 changes: 7 additions & 0 deletions crates/cli/integration/no-shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -euxo pipefail

watchexec=${WATCHEXEC_BIN:-watchexec}

$watchexec -1 -n echo 'foo bar' | grep 'foo bar'
7 changes: 7 additions & 0 deletions crates/cli/integration/stdin-quit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -euxo pipefail

watchexec=${WATCHEXEC_BIN:-watchexec}

timeout -s9 30s sh -c "sleep 10 | $watchexec --stdin-quit echo"
13 changes: 13 additions & 0 deletions crates/cli/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -euo pipefail

export WATCHEXEC_BIN=$(realpath ${WATCHEXEC_BIN:-$(which watchexec)})

cd "$(dirname "${BASH_SOURCE[0]}")/integration"
for test in *.sh; do
echo
echo
echo "======= Testing $test ======="
./$test
done
10 changes: 7 additions & 3 deletions crates/cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,18 @@ pub struct Args {
/// Takes a pair of signal names, separated by a colon, such as "TERM:INT" to map SIGTERM to
/// SIGINT. The first signal is the one received by watchexec, and the second is the one sent to
/// the command. The second can be omitted to discard the first signal, such as "TERM:" to
/// not do anything on SIGTERM. Note this can make it hard to quit watchexec itself.
/// not do anything on SIGTERM.
///
/// If SIGINT or SIGTERM are mapped, then they no longer quit Watchexec. Besides making it hard
/// to quit Watchexec itself, this is useful to send pass a Ctrl-C to the command without also
/// terminating Watchexec and the underlying program with it, e.g. with "INT:INT".
///
/// This option can be specified multiple times to map multiple signals.
///
/// Signal syntax is case-insensitive for short names (like "TERM", "USR2") and long names (like
/// "SIGKILL", "SIGHUP"). Signal numbers are also supported (like "15", "31"). On Windows, the
/// forms "STOP", "CTRL+C", "CTRL+BREAK", and "CTRL+CLOSE" are also supported to parse, but will
/// not actually do anything as Watchexec cannot yet deliver nor receive those events.
/// forms "STOP", "CTRL+C", and "CTRL+BREAK" are also supported to receive, but Watchexec cannot
/// yet deliver other "signals" than a STOP.
#[arg(long = "map-signal", value_name = "SIGNAL:SIGNAL", value_parser = SignalMappingValueParser)]
pub signal_map: Vec<SignalMapping>,

Expand Down
10 changes: 6 additions & 4 deletions crates/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
env::current_dir,
ffi::{OsStr, OsString},
fs::File,
io::{stderr, IsTerminal, Write},
io::{IsTerminal, Write},
path::Path,
process::Stdio,
sync::Arc,
Expand Down Expand Up @@ -147,6 +147,7 @@ pub fn make_config(args: &Args, state: &State) -> Result<Config> {

let delay_run = args.delay_run.map(|ts| ts.0);
let on_busy = args.on_busy_update;
let stdin_quit = args.stdin_quit;

let signal = args.signal;
let stop_signal = args.stop_signal;
Expand Down Expand Up @@ -256,7 +257,7 @@ pub fn make_config(args: &Args, state: &State) -> Result<Config> {
.events
.iter()
.any(|e| e.tags.contains(&Tag::Keyboard(Keyboard::Eof)));
if is_keyboard_eof {
if stdin_quit && is_keyboard_eof {
debug!("keyboard EOF, quit");
show_events();
action.quit();
Expand Down Expand Up @@ -561,8 +562,9 @@ fn end_of_process(state: &CommandState, outflags: OutputFlags) {
}

if outflags.bell {
eprint!("\x07");
stderr().flush().ok();
let mut stdout = std::io::stdout();
stdout.write_all(b"\x07").ok();
stdout.flush().ok();
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/watchexec.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<assemblyIdentity
type="win32"
name="Watchexec.Cli.watchexec"
version="1.23.0.0"
version="1.24.0.0"
/>

<trustInfo>
Expand Down
2 changes: 1 addition & 1 deletion crates/filterer/globset/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Next (YYYY-MM-DD)

## v2.0.0 (2023-11-27)
## v2.0.0 (2023-12-09)

- Depend on `watchexec-events` instead of the `watchexec` re-export.

Expand Down
2 changes: 1 addition & 1 deletion crates/filterer/ignore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Next (YYYY-MM-DD)

## v2.0.0 (2023-11-27)
## v2.0.0 (2023-12-09)

- Depend on `watchexec-events` instead of the `watchexec` re-export.

Expand Down
10 changes: 6 additions & 4 deletions doc/watchexec.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH watchexec 1 "watchexec 1.23.0"
.TH watchexec 1 "watchexec 1.24.0"
.SH NAME
watchexec \- Execute commands when watched files change
.SH SYNOPSIS
Expand Down Expand Up @@ -101,11 +101,13 @@ This has no practical effect on Windows as the command is always forcefully term
\fB\-\-map\-signal\fR=\fISIGNAL:SIGNAL\fR
Translate signals from the OS to signals to send to the command

Takes a pair of signal names, separated by a colon, such as "TERM:INT" to map SIGTERM to SIGINT. The first signal is the one received by watchexec, and the second is the one sent to the command. The second can be omitted to discard the first signal, such as "TERM:" to not do anything on SIGTERM. Note this can make it hard to quit watchexec itself.
Takes a pair of signal names, separated by a colon, such as "TERM:INT" to map SIGTERM to SIGINT. The first signal is the one received by watchexec, and the second is the one sent to the command. The second can be omitted to discard the first signal, such as "TERM:" to not do anything on SIGTERM.

If SIGINT or SIGTERM are mapped, then they no longer quit Watchexec. Besides making it hard to quit Watchexec itself, this is useful to send pass a Ctrl\-C to the command without also terminating Watchexec and the underlying program with it, e.g. with "INT:INT".

This option can be specified multiple times to map multiple signals.

Signal syntax is case\-insensitive for short names (like "TERM", "USR2") and long names (like "SIGKILL", "SIGHUP"). Signal numbers are also supported (like "15", "31"). On Windows, the forms "STOP", "CTRL+C", "CTRL+BREAK", and "CTRL+CLOSE" are also supported to parse, but will not actually do anything as Watchexec cannot yet deliver nor receive those events.
Signal syntax is case\-insensitive for short names (like "TERM", "USR2") and long names (like "SIGKILL", "SIGHUP"). Signal numbers are also supported (like "15", "31"). On Windows, the forms "STOP", "CTRL+C", and "CTRL+BREAK" are also supported to receive, but Watchexec cannot yet deliver other "signals" than a STOP.
.TP
\fB\-d\fR, \fB\-\-debounce\fR=\fITIMEOUT\fR
Time to wait for new events before taking action
Expand Down Expand Up @@ -522,6 +524,6 @@ Use @argfile as first argument to load arguments from the file \*(Aqargfile\*(Aq

Didn\*(Aqt expect this much output? Use the short \*(Aq\-h\*(Aq flag to get short help.
.SH VERSION
v1.23.0
v1.24.0
.SH AUTHORS
Félix Saparelli <felix@passcod.name>, Matt Green <mattgreenrocks@gmail.com>
15 changes: 9 additions & 6 deletions doc/watchexec.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,20 @@ Takes a pair of signal names, separated by a colon, such as \"TERM:INT\"
to map SIGTERM to SIGINT. The first signal is the one received by
watchexec, and the second is the one sent to the command. The second can
be omitted to discard the first signal, such as \"TERM:\" to not do
anything on SIGTERM. Note this can make it hard to quit watchexec
itself.
anything on SIGTERM.

If SIGINT or SIGTERM are mapped, then they no longer quit Watchexec.
Besides making it hard to quit Watchexec itself, this is useful to send
pass a Ctrl-C to the command without also terminating Watchexec and the
underlying program with it, e.g. with \"INT:INT\".

This option can be specified multiple times to map multiple signals.

Signal syntax is case-insensitive for short names (like \"TERM\",
\"USR2\") and long names (like \"SIGKILL\", \"SIGHUP\"). Signal numbers
are also supported (like \"15\", \"31\"). On Windows, the forms
\"STOP\", \"CTRL+C\", \"CTRL+BREAK\", and \"CTRL+CLOSE\" are also
supported to parse, but will not actually do anything as Watchexec
cannot yet deliver nor receive those events.
\"STOP\", \"CTRL+C\", and \"CTRL+BREAK\" are also supported to receive,
but Watchexec cannot yet deliver other \"signals\" than a STOP.

**-d**, **\--debounce**=*TIMEOUT*

Expand Down Expand Up @@ -758,7 +761,7 @@ Didnt expect this much output? Use the short -h flag to get short help.

# VERSION

v1.23.0
v1.24.0

# AUTHORS

Expand Down
5 changes: 0 additions & 5 deletions test/print_hi.py

This file was deleted.