Changed run_command to use create_subprocess_shell
This commit is contained in:
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
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user