island: Extract code to `_get_null_value_for_win32()` in file_utils.py

This commit is contained in:
Shreya 2021-06-15 19:00:12 +05:30
parent b648452b5f
commit 37889d0b87
1 changed files with 6 additions and 3 deletions

View File

@ -96,9 +96,7 @@ def _get_file_descriptor_for_new_secure_file_windows(path: str):
security_attributes, security_attributes,
file_creation, file_creation,
file_attributes, file_attributes,
win32job.CreateJobObject( _get_null_value_for_win32(),
None, ""
), # https://stackoverflow.com/questions/46800142/in-python-with-pywin32-win32job-the-createjobobject-function-how-do-i-pass-nu # noqa: E501
) )
return fd return fd
@ -106,3 +104,8 @@ def _get_file_descriptor_for_new_secure_file_windows(path: str):
except Exception as ex: except Exception as ex:
LOG.error(f'Could not create a file at "{path}": {str(ex)}') LOG.error(f'Could not create a file at "{path}": {str(ex)}')
raise ex raise ex
def _get_null_value_for_win32() -> None:
# https://stackoverflow.com/questions/46800142/in-python-with-pywin32-win32job-the-createjobobject-function-how-do-i-pass-nu # noqa: E501
return win32job.CreateJobObject(None, "")