sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit da2726ca7789f7b6edf85cee496f20fdc1332afc
parent 5934cb409782091b6d4481ceccf77e82832167ec
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 22 Mar 2022 10:58:25 +0100

README: improve error handling in downloader example

- Return exit code, which makes xargs return 123 when any of the downloads
  failed.
- Write errors to stderr.
- Write non-errors to stdout.

Diffstat:
MREADME | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/README b/README @@ -783,7 +783,7 @@ arguments are specified then the data is read from stdin. else s="$2" fi - printf '[%s]: %s: %s\n' "$(date +'%H:%M:%S')" "${s}" "$3" >&2 + printf '[%s]: %s: %s\n' "$(date +'%H:%M:%S')" "${s}" "$3" } # fetch(url, feedname) @@ -809,8 +809,8 @@ arguments are specified then the data is read from stdin. if [ "${feedname}" != "-" ]; then mkdir -p "${feedname}" if ! cd "${feedname}"; then - log "${feedname}" "${msg}: ${feedname}" "DIR FAIL" - exit 1 + log "${feedname}" "${msg}: ${feedname}" "DIR FAIL" >&2 + return 1 fi fi @@ -825,8 +825,10 @@ arguments are specified then the data is read from stdin. printf '%s\n' "${url}" >> "${cachefile}" ) 9>"${lockfile}" else - log "${feedname}" "${msg}" "FAIL" + log "${feedname}" "${msg}" "FAIL" >&2 + return 1 fi + return 0 } if [ "${SFEED_DOWNLOAD_CHILD}" = "1" ]; then