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

Suppress git output so we get less emails #478

Merged
merged 1 commit into from
Nov 30, 2023
Merged
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
11 changes: 9 additions & 2 deletions server/scraper/resto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading