fix(seautils): catch the error that is raised if dig is not installed on the system
This commit is contained in:
parent
7a2ee0a655
commit
d444242245
1 changed files with 8 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
import asyncio
|
||||
import inspect
|
||||
import operator
|
||||
from asyncio.subprocess import Process
|
||||
from functools import partial, partialmethod
|
||||
from typing import Any
|
||||
|
||||
|
@ -97,8 +98,13 @@ class SeaUtils(commands.Cog):
|
|||
command_opts.extend(['-p', port])
|
||||
command_opts.extend(['+yaml'])
|
||||
|
||||
process = await asyncio.create_subprocess_exec(*command_opts, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||
stdout, stderr = await process.communicate()
|
||||
try:
|
||||
process: Process = await asyncio.create_subprocess_exec(*command_opts, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||
stdout, stderr = await process.communicate()
|
||||
except (FileNotFoundError):
|
||||
await ctx.maybe_send_embed(content="The `dig` command is not installed on this system.")
|
||||
return
|
||||
|
||||
if stderr:
|
||||
await ctx.maybe_send_embed(content= "An error was encountered!\n" + cf.box(text=stderr.decode()))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue