Move logging code outside of command execution try-except block (#2739)
This commit is contained in:
parent
8ec1715eb8
commit
481b570dae
|
|
@ -302,7 +302,7 @@ class SysCommandWorker:
|
||||||
# https://stackoverflow.com/questions/4022600/python-pty-fork-how-does-it-work
|
# https://stackoverflow.com/questions/4022600/python-pty-fork-how-does-it-work
|
||||||
if not self.pid:
|
if not self.pid:
|
||||||
history_logfile = pathlib.Path(f"{storage['LOG_PATH']}/cmd_history.txt")
|
history_logfile = pathlib.Path(f"{storage['LOG_PATH']}/cmd_history.txt")
|
||||||
try:
|
|
||||||
change_perm = False
|
change_perm = False
|
||||||
if history_logfile.exists() is False:
|
if history_logfile.exists() is False:
|
||||||
change_perm = True
|
change_perm = True
|
||||||
|
|
@ -324,6 +324,7 @@ class SysCommandWorker:
|
||||||
if storage.get('arguments', {}).get('debug'):
|
if storage.get('arguments', {}).get('debug'):
|
||||||
debug(f"Executing: {self.cmd}")
|
debug(f"Executing: {self.cmd}")
|
||||||
|
|
||||||
|
try:
|
||||||
os.execve(self.cmd[0], list(self.cmd), {**os.environ, **self.environment_vars})
|
os.execve(self.cmd[0], list(self.cmd), {**os.environ, **self.environment_vars})
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
error(f"{self.cmd[0]} does not exist.")
|
error(f"{self.cmd[0]} does not exist.")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue