Skip to content

Commit 0f612a8

Browse files
committed
telegram-chat: give a hint if command is still running
1 parent be52bc1 commit 0f612a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

telegram-chat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,18 @@ $WaitFullyConnected;
9696
} else={
9797
:if ($TelegramChatActive = true && [ :len $Text ] > 0) do={
9898
:if ([ $ValidateSyntax $Text ] = true) do={
99+
:local State "";
99100
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);
100101
$MkDir "tmpfs/telegram-chat";
101102
$LogPrintExit2 info $0 ("Running command: " . $Text) false;
102103
:exec script=($Text . "; :execute script=\":put\" file=" . $File . ".done") file=$File;
103104
:if ([ $WaitForFile ($File . ".done.txt") 200 ] = false) do={
104-
$LogPrintExit2 warning $0 ("Command did not finish, possibly still running.") false;
105+
:set State "The command did not finish, still running in background.\n\n";
105106
}
106107
:local Content [ /file/get ($File . ".txt") content ];
107108
$SendTelegram2 ({ origin=$0; silent=false; \
108109
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
109-
message=("Command:\n" . $Text . "\n\nOutput:\n" . $Content) });
110+
message=("Command:\n" . $Text . "\n\n" . $State . "Output:\n" . $Content) });
110111
/file/remove "tmpfs/telegram-chat";
111112
} else={
112113
$LogPrintExit2 warning $0 ("The command failed syntax validation: " . $Text) false;

0 commit comments

Comments
 (0)