From a3d8568dd6b50ea344cc49dd0cbaa180653a1603 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 10 Oct 2023 18:39:52 +0900 Subject: [PATCH] [tools] Update spell-check.sh to handle SIGINT --- tools/spell-check.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/spell-check.sh b/tools/spell-check.sh index ac48a0a..4dcb774 100755 --- a/tools/spell-check.sh +++ b/tools/spell-check.sh @@ -46,13 +46,14 @@ if [[ -n "$(git ls-files '*Cargo.toml')" ]]; then fi config_old=$(<.cspell.json) config_new=$(grep <<<"${config_old}" -v ' *//' | jq 'del(.dictionaries[])' | jq 'del(.dictionaryDefinitions[])') +trap -- 'echo "${config_old}" >.cspell.json; echo >&2 "$0: trapped SIGINT"; exit 1' SIGINT echo "${config_new}" >.cspell.json if [[ -n "${has_rust}" ]]; then - dependencies_words=$(npx <<<"${dependencies}" cspell stdin --no-progress --no-summary --words-only --unique || true) + dependencies_words=$(npx <<<"${dependencies}" -y cspell stdin --no-progress --no-summary --words-only --unique || true) fi -all_words=$(npx cspell --no-progress --no-summary --words-only --unique $(git ls-files | (grep -v "${project_dictionary//\./\\.}" || true)) || true) -# TODO: handle SIGINT +all_words=$(npx -y cspell --no-progress --no-summary --words-only --unique $(git ls-files | (grep -v "${project_dictionary//\./\\.}" || true)) || true) echo "${config_old}" >.cspell.json +trap - SIGINT cat >.github/.cspell/rust-dependencies.txt <