Skip to content

Commit

Permalink
telegram-chat: ... and give a hint on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
eworm-de committed Feb 1, 2023
1 parent c2cf05e commit a073835
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion telegram-chat
Original file line number Diff line number Diff line change
Expand Up @@ -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"); \
Expand Down

0 comments on commit a073835

Please sign in to comment.