Handle exit codes

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-08-15 01:29:37 +03:00
parent 3d7fef228f
commit 5ed3ff371e
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2

View file

@ -13,6 +13,7 @@ import sys
from multiprocessing import Process
from random import randint as semi_random_int
from subprocess import check_output as check_command_output
from subprocess import CalledProcessError
from time import time as time_timestamp
from traceback import format_exc as get_traceback_str
from typing import Any, Awaitable, Dict, List, Optional
@ -328,6 +329,8 @@ Executed query `{uncode(sql_query)}`
output = check_command_output(sh_command.split(" ")).decode()
except FileNotFoundError:
output = "Command not found"
except CalledProcessError:
output = "Command existed with non-zero code"
await self._send_message(
m(