Error handling cmd history (#1560)
* If we encounter a FileNotFoundError, the cmd_history.txt file or parent directory does not exist. This leads to vague errors upstream of cmd executable file not existing if this is the case. Probably this is a valid situation and we should just pass on the error.
This commit is contained in:
parent
5669f3ba46
commit
e4f3198505
|
|
@ -391,6 +391,13 @@ class SysCommandWorker:
|
|||
os.chmod(str(history_logfile), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
|
||||
except PermissionError:
|
||||
pass
|
||||
# If history_logfile does not exist, ignore the error
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except Exception as e:
|
||||
exception_type = type(e).__name__
|
||||
log(f"Unexpected {exception_type} occurred in {self.cmd}: {e}", level=logging.ERROR)
|
||||
raise e
|
||||
|
||||
os.execve(self.cmd[0], list(self.cmd), {**os.environ, **self.environment_vars})
|
||||
if storage['arguments'].get('debug'):
|
||||
|
|
|
|||
Loading…
Reference in New Issue