diff --git a/monkey/monkey_island/cc/environment/utils.py b/monkey/monkey_island/cc/environment/utils.py index 0a84e6aac..1fb998a5f 100644 --- a/monkey/monkey_island/cc/environment/utils.py +++ b/monkey/monkey_island/cc/environment/utils.py @@ -62,9 +62,7 @@ def _create_secure_file_linux(path: str): os.O_RDWR | os.O_CREAT | os.O_EXCL ) # read/write, create new, throw error if file exists mode = 0o700 # read/write/execute permissions to owner - - with os.open(path, flags, mode) as x: # noqa: F841 - pass + os.close(os.open(path, flags, mode)) except Exception as ex: LOG.error(f'Could not create a file at "{path}": {str(ex)}')