From 0d3ec6f46f76e02e6d67d3fc568622872b7b036a Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Thu, 11 Jan 2018 11:07:42 -0600 Subject: [PATCH] Use a shell in the bash command --- cogs/owner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cogs/owner.py b/cogs/owner.py index f061906..e561604 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -253,12 +253,12 @@ class Owner: @commands.check(utils.is_owner) async def bash(self, ctx, *, cmd: str): """Runs a bash command""" - proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) + proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) output, error = proc.communicate() if output: - await ctx.send("STDOUT:\n```\n{}```".format(output.decode("utf-8", "ignore"))) + await ctx.send("STDOUT:\n```\n{}```".format(output.decode("utf-8", "ignore").strip())) if error: - await ctx.send("STDERR:\n```\n{}```".format(error.decode("utf-8", "ignore"))) + await ctx.send("STDERR:\n```\n{}```".format(error.decode("utf-8", "ignore").strip())) @commands.command() @commands.check(utils.is_owner)