From e7d877d83aaef9e51b2afbf50e8ae2760ec9a419 Mon Sep 17 00:00:00 2001 From: redfast00 Date: Thu, 30 Nov 2023 20:03:03 +0100 Subject: [PATCH] Suppress git output so we get less emails --- server/scraper/resto.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/scraper/resto.sh b/server/scraper/resto.sh index aea84cb0..f14310fd 100755 --- a/server/scraper/resto.sh +++ b/server/scraper/resto.sh @@ -19,6 +19,13 @@ function usage() { echo " push true or false, depending on if you want to push to the repo or not" } +function suppress +{ + TMP=$(mktemp) + ${1+"$@"} > "$TMP" 2>&1 || ( echo "$@ exited with $?" && cat "$TMP" ) + rm "$TMP" +} + if [[ $# -lt 2 ]]; then echo "error: 2 operands are required" >&2 usage @@ -60,6 +67,6 @@ git diff-index --quiet HEAD || git commit -m "Scraper: new data from $today" # Porcelain prevents git from writing non-errors to stderr, resulting in emails if [[ "$push" == true ]]; then - git pull - git push --porcelain + suppress git pull + suppress git push --porcelain fi \ No newline at end of file