aboutsummaryrefslogtreecommitdiffstats
path: root/telegram-chat
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-01 11:09:34 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-01 11:29:56 +0100
commita07383566755a30fc03374f2bc83d78d3f6dad54 (patch)
treeb2809177161f10b7ceb4c90c3e1caaa299ec5451 /telegram-chat
parentc2cf05e9e59c60aa24e7d57d53b81c4b919b8495 (diff)
telegram-chat: ... and give a hint on failure
Diffstat (limited to 'telegram-chat')
-rw-r--r--telegram-chat5
1 files changed, 4 insertions, 1 deletions
diff --git a/telegram-chat b/telegram-chat
index 2f60a62..1c10fcd 100644
--- a/telegram-chat
+++ b/telegram-chat
@@ -100,11 +100,14 @@ $WaitFullyConnected;
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);
$MkDir "tmpfs/telegram-chat";
$LogPrintExit2 info $0 ("Running command: " . $Text) false;
- :exec script=(":do {\n" . $Text . "\n} on-error={};" . \
+ :exec script=(":do {\n" . $Text . "\n} on-error={ :execute script=\":put\" file=" . $File . ".failed };" . \
":execute script=\":put\" file=" . $File . ".done") file=$File;
:if ([ $WaitForFile ($File . ".done.txt") 200 ] = false) do={
:set State "The command did not finish, still running in background.\n\n";
}
+ :if ([ :len [ /file/find where name=($File . ".failed.txt") ] ] > 0) do={
+ :set State "The command failed with an error!\n\n";
+ }
:local Content [ /file/get ($File . ".txt") content ];
$SendTelegram2 ({ origin=$0; silent=false; \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \