Browse Source

make debug info an attachment

Pi 1 year ago
parent
commit
0b5fe11562
1 changed files with 4 additions and 2 deletions
  1. 4 2
      cropswap-debug.sh

+ 4 - 2
cropswap-debug.sh

@@ -3,7 +3,7 @@ set -euo pipefail
 
 CROPSWAPDEBUG=cropswap-debug@shandan.one
 SENDMAIL=/usr/sbin/sendmail
-
+: ${TEST:=0}
 if (( TEST != 0)); then
 	cat -
 	cat <<-EOF >&2
@@ -11,7 +11,9 @@ if (( TEST != 0)); then
 	$(env)
 	EOF
 else
-	cat /proc/self/fd/5 - 5< <(cat -) <<-EOF | "$SENDMAIL" -F "${FROM:-}" -f "${MAILGROUP:-}" "${CROPSWAPDEBUG}"
+	makemime -j /proc/self/fd/{4,5} 4< <(cat -) 5<<-EOF | "$SENDMAIL" -F "${FROM:-}" -f "${MAILGROUP:-}" "${CROPSWAPDEBUG}"
+	Content-Type: text/plain; charset="utf-8"
+	Content-Disposition: attachment
 
 	ERROR ${1:-unknown}
 	$(env)