Changed run_command to use create_subprocess_shell

add-license-1
DustyP 8 years ago
parent a87f10d985
commit c6c4b1eb91

@ -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/.*@.*[.].*/<email>/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/.*@.*[.].*/<email>/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}')

@ -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

@ -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)

Loading…
Cancel
Save