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',
|
title=f'Git Pull',
|
||||||
color=embed_color)
|
color=embed_color)
|
||||||
em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}')
|
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 fetch --all')),120) + '\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 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)
|
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)
|
results = paginate(result, maxlen=1014)
|
||||||
for page in results[:5]:
|
for page in results[:5]:
|
||||||
em.add_field(name='', value=f'{page}')
|
em.add_field(name='', value=f'{page}')
|
||||||
@ -40,7 +40,7 @@ class Git():
|
|||||||
title=f'Git Pull',
|
title=f'Git Pull',
|
||||||
color=embed_color)
|
color=embed_color)
|
||||||
em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}')
|
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)
|
results = paginate(result, maxlen=1014)
|
||||||
for page in results[:5]:
|
for page in results[:5]:
|
||||||
em.add_field(name='', value=f'{page}')
|
em.add_field(name='', value=f'{page}')
|
||||||
|
|||||||
@ -77,8 +77,8 @@ def paginate(text, maxlen=1990):
|
|||||||
|
|
||||||
async def run_command(*args):
|
async def run_command(*args):
|
||||||
# Create subprocess
|
# Create subprocess
|
||||||
process = await asyncio.create_subprocess_exec(
|
process = await asyncio.create_subprocess_shell(
|
||||||
*args,
|
args,
|
||||||
# stdout must a pipe to be accessible as process.stdout
|
# stdout must a pipe to be accessible as process.stdout
|
||||||
stdout=asyncio.subprocess.PIPE)
|
stdout=asyncio.subprocess.PIPE)
|
||||||
# Wait for the subprocess to finish
|
# Wait for the subprocess to finish
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class REPL():
|
|||||||
await ctx.send(page)
|
await ctx.send(page)
|
||||||
else:
|
else:
|
||||||
self._last_result = ret
|
self._last_result = ret
|
||||||
if value:
|
if value:
|
||||||
for page in paginate(value):
|
for page in paginate(value):
|
||||||
await ctx.send(page)
|
await ctx.send(page)
|
||||||
for page in paginate(ret):
|
for page in paginate(ret):
|
||||||
@ -160,7 +160,7 @@ class REPL():
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
body = self.cleanup_code(body).split(' ')
|
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
|
value = result
|
||||||
for page in paginate(value):
|
for page in paginate(value):
|
||||||
await ctx.send(page)
|
await ctx.send(page)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user