1
0

windows binaries: try to prevent users from renaming exe while running

closes https://github.com/spesmilo/electrum/issues/4072
(this fix AFAICT only works on Windows, and #4072 contains some macOS reports as well,
however all recent reports are for Windows and overall most reports are for Windows,
so let's close it optimistically for now)
This commit is contained in:
SomberNight
2022-05-29 03:26:20 +02:00
parent 00183b5412
commit ae76a0daf5

View File

@@ -56,6 +56,12 @@ if is_git_clone:
if is_local or is_android:
sys.path.insert(0, os.path.join(script_dir, 'packages'))
if is_pyinstaller:
# Keep an open file handle for the binary that started us. On Windows, this
# prevents users from moving or renaming the exe file while running (doing which
# causes ImportErrors and other runtime failures). (see #4072)
_file = open(sys.executable, 'rb')
def check_imports():
# pure-python dependencies need to be imported here for pyinstaller