Skip to content

Commit a073835

Browse files
committed
telegram-chat: ... and give a hint on failure
1 parent c2cf05e commit a073835

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

telegram-chat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,14 @@ $WaitFullyConnected;
100100
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);
101101
$MkDir "tmpfs/telegram-chat";
102102
$LogPrintExit2 info $0 ("Running command: " . $Text) false;
103-
:exec script=(":do {\n" . $Text . "\n} on-error={};" . \
103+
:exec script=(":do {\n" . $Text . "\n} on-error={ :execute script=\":put\" file=" . $File . ".failed };" . \
104104
":execute script=\":put\" file=" . $File . ".done") file=$File;
105105
:if ([ $WaitForFile ($File . ".done.txt") 200 ] = false) do={
106106
:set State "The command did not finish, still running in background.\n\n";
107107
}
108+
:if ([ :len [ /file/find where name=($File . ".failed.txt") ] ] > 0) do={
109+
:set State "The command failed with an error!\n\n";
110+
}
108111
:local Content [ /file/get ($File . ".txt") content ];
109112
$SendTelegram2 ({ origin=$0; silent=false; \
110113
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \

0 commit comments

Comments
 (0)