update_manager: add support for setting a shell command's cwd

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-03-27 21:19:13 -04:00 committed by Arksine
parent f1f318ea40
commit 6b0d981274
1 changed files with 4 additions and 4 deletions

View File

@ -326,9 +326,9 @@ class CommandHelper:
break break
async def run_cmd(self, cmd, timeout=20., notify=False, async def run_cmd(self, cmd, timeout=20., notify=False,
retries=1, env=None): retries=1, env=None, cwd=None):
cb = self.notify_update_response if notify else None cb = self.notify_update_response if notify else None
scmd = self.build_shell_command(cmd, callback=cb, env=env) scmd = self.build_shell_command(cmd, callback=cb, env=env, cwd=cwd)
while retries: while retries:
if await scmd.run(timeout=timeout): if await scmd.run(timeout=timeout):
break break
@ -337,8 +337,8 @@ class CommandHelper:
raise self.server.error("Shell Command Error") raise self.server.error("Shell Command Error")
async def run_cmd_with_response(self, cmd, timeout=20., retries=5, async def run_cmd_with_response(self, cmd, timeout=20., retries=5,
env=None): env=None, cwd=None):
scmd = self.build_shell_command(cmd, None, env=env) scmd = self.build_shell_command(cmd, None, env=env, cwd=cwd)
result = await scmd.run_with_response(timeout, retries) result = await scmd.run_with_response(timeout, retries)
return result return result