From c6c4b1eb918cdb58ec5316e0c0f99726af2eb4f2 Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Sat, 14 Apr 2018 03:11:13 -0800 Subject: [PATCH] Changed run_command to use create_subprocess_shell --- exts/git.py | 8 ++++---- exts/imports/utils.py | 4 ++-- exts/repl.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exts/git.py b/exts/git.py index 39de659..ef4d944 100644 --- a/exts/git.py +++ b/exts/git.py @@ -25,9 +25,9 @@ class Git(): title=f'Git Pull', color=embed_color) em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}') - result = await asyncio.wait_for(self.bot.loop.create_task(run_command('git','fetch','--all')),10) + '\n' - result += await asyncio.wait_for(self.bot.loop.create_task(run_command('git','reset','--hard','origin/master')),10) + '\n' - result += await asyncio.wait_for(self.bot.loop.create_task(run_command('git','show','--stat','|','sed','"s/.*@.*[.].*//g"')),10) + result = await asyncio.wait_for(self.bot.loop.create_task(run_command('git fetch --all')),120) + '\n' + result += await asyncio.wait_for(self.bot.loop.create_task(run_command('git reset --hard origin/master')),120) + '\n' + result += await asyncio.wait_for(self.bot.loop.create_task(run_command('git show --stat | sed "s/.*@.*[.].*//g"')),10) results = paginate(result, maxlen=1014) for page in results[:5]: em.add_field(name='￲', value=f'{page}') @@ -40,7 +40,7 @@ class Git(): title=f'Git Pull', color=embed_color) em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}') - result = await asyncio.wait_for(self.bot.loop.create_task(run_command('git','status')),10) + result = await asyncio.wait_for(self.bot.loop.create_task(run_command('git status')),10) results = paginate(result, maxlen=1014) for page in results[:5]: em.add_field(name='￲', value=f'{page}') diff --git a/exts/imports/utils.py b/exts/imports/utils.py index 2509914..6c5923f 100644 --- a/exts/imports/utils.py +++ b/exts/imports/utils.py @@ -77,8 +77,8 @@ def paginate(text, maxlen=1990): async def run_command(*args): # Create subprocess - process = await asyncio.create_subprocess_exec( - *args, + process = await asyncio.create_subprocess_shell( + args, # stdout must a pipe to be accessible as process.stdout stdout=asyncio.subprocess.PIPE) # Wait for the subprocess to finish diff --git a/exts/repl.py b/exts/repl.py index 3aae7e3..6bd9d41 100644 --- a/exts/repl.py +++ b/exts/repl.py @@ -76,7 +76,7 @@ class REPL(): await ctx.send(page) else: self._last_result = ret - if value: + if value: for page in paginate(value): await ctx.send(page) for page in paginate(ret): @@ -160,7 +160,7 @@ class REPL(): return try: body = self.cleanup_code(body).split(' ') - result = await asyncio.wait_for(self.bot.loop.create_task(run_command(*body)),10) + result = await asyncio.wait_for(self.bot.loop.create_task(run_command(body)),10) value = result for page in paginate(value): await ctx.send(page)