diff options
author | Christian Hesse <mail@eworm.de> | 2023-02-01 11:01:59 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-02-01 11:29:56 +0100 |
commit | 44c30efbcd77f85a92595d06e4531fca1461f101 (patch) | |
tree | 5df8d5af23cd7db6905d217d44cda12fbe43d99c | |
parent | 7e7987afec9e8bbbaecb9c84d267097568d7edc7 (diff) |
telegram-chat: give a hint if command is still running
-rw-r--r-- | telegram-chat | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/telegram-chat b/telegram-chat index 9c8261e..aeb4e6d 100644 --- a/telegram-chat +++ b/telegram-chat @@ -96,17 +96,18 @@ $WaitFullyConnected; } else={ :if ($TelegramChatActive = true && [ :len $Text ] > 0) do={ :if ([ $ValidateSyntax $Text ] = true) do={ + :local State ""; :local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]); $MkDir "tmpfs/telegram-chat"; $LogPrintExit2 info $0 ("Running command: " . $Text) false; :exec script=($Text . "; :execute script=\":put\" file=" . $File . ".done") file=$File; :if ([ $WaitForFile ($File . ".done.txt") 200 ] = false) do={ - $LogPrintExit2 warning $0 ("Command did not finish, possibly still running.") false; + :set State "The command did not finish, still running in background.\n\n"; } :local Content [ /file/get ($File . ".txt") content ]; $SendTelegram2 ({ origin=$0; silent=false; \ subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \ - message=("Command:\n" . $Text . "\n\nOutput:\n" . $Content) }); + message=("Command:\n" . $Text . "\n\n" . $State . "Output:\n" . $Content) }); /file/remove "tmpfs/telegram-chat"; } else={ $LogPrintExit2 warning $0 ("The command failed syntax validation: " . $Text) false; |