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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user