Handle errors in sh command
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
2dd258d0b0
commit
3d7fef228f
|
@ -323,6 +323,12 @@ Executed query `{uncode(sql_query)}`
|
|||
await self._send_message(m("No command specified", message))
|
||||
return
|
||||
|
||||
output: str
|
||||
try:
|
||||
output = check_command_output(sh_command.split(" ")).decode()
|
||||
except FileNotFoundError:
|
||||
output = "Command not found"
|
||||
|
||||
await self._send_message(
|
||||
m(
|
||||
f"""
|
||||
|
@ -330,7 +336,7 @@ Command: `{uncode(sh_command)}`
|
|||
|
||||
Output:
|
||||
```
|
||||
{uncode(check_command_output(sh_command.split(" ")).decode())}
|
||||
{uncode(output)}
|
||||
```
|
||||
""",
|
||||
message,
|
||||
|
|
Loading…
Reference in a new issue