Skip to content

Commit 4488f10

Browse files
seafoodfrypb8o
authored andcommitted
Made pre-commit work in sillicon macos and linux
While running the previous version of the precommit I got the following error: ``` Found configured hook: pre-commit Running command: sh pre-commit Fetching advisory database from `https://github.com/RustSec/advisory-db.git` Updating crates.io index Scanning Cargo.lock for vulnerabilities (184 crate dependencies) src/jailer/src/env.rs sed: illegal option -- z usage: sed script [-Ealnru] [-i extension] [file ...] sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...] Configured hook command failed pre-commit hook rejected ``` Tested a couple different things and the `paste` command seemed to work both on macos (M1) and on linux (tested it in an ubuntu:22.04 container). Signed-off-by: seafoodfry <[email protected]>
1 parent de48fd6 commit 4488f10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ for i in $(git diff --name-only --cached --diff-filter=d); do
2323
extension="${filename##*.}"
2424
if [ "$extension" = "rs" ]; then
2525
# Read rustfmt config, replace '\n' with ','
26-
rustfmt_config="$(sed -z "s/\n/,/g;s/,$/\n/" ./tests/fmt.toml)"
26+
rustfmt_config="$(paste -sd, ./tests/fmt.toml)"
2727
# We first do a check run, this will fail when it finds a non-matching license.
2828
rustfmt $i --check --config $rustfmt_config
2929
# Run `cargo fmt` for this file

0 commit comments

Comments
 (0)