forked from p15670423/monkey
island: Can't use `with` with `os.open()`, use `os.close()` to close file descriptor
This commit is contained in:
parent
8b932e1946
commit
5fe0c80377
|
@ -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)}')
|
||||
|
|
Loading…
Reference in New Issue