thp / urlwatch

Watch (parts of) webpages and get notified when something changes via e-mail, on your phone or via other means. Highly configurable.
https://thp.io/2008/urlwatch/
Other
2.81k stars 352 forks source link

urlwatch.jobs.ShellError does not report job output via Emailreporter #689

Closed kongomongo closed 2 years ago

kongomongo commented 2 years ago

Hi there,

I have a job setup like this:

name: "test"
command: "~/.config/urlwatch/test.sh 'ww.test.de'"
user_visible_url: "https://www.test.de"
diff_tool: wdiff

test.sh

#!/bin/bash
set -e

URL=$1

JSON=$(curl -s "$URL" \
  -H 'Accept: application/json, text/plain, */*' \
  --compressed \
  --connect-timeout 10)

JQ=$(echo \
  'def round: . + 0.5 | floor; ' \
  'sort_by(.price) | ' \
  '.[0]')

echo "$JSON" | jq "$JQ"

so now when there is something amiss I get this error from Emailreporter:

error: test
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/urlwatch/handler.py", line 113, in process
    data = self.job.retrieve(self)
  File "/usr/local/lib/python3.7/dist-packages/urlwatch/jobs.py", line 209, in retrieve
    raise ShellError(result)
urlwatch.jobs.ShellError: ShellError: Exit status 28
________________________________________

So now I wonder where are the error messages?

Are they consumed somewhere? Is this by design? I think having the error messages print out would be helpful

thp commented 2 years ago

This has been fixed in the master branch now, and the ShellError contains stdout and stderr by default.