mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Catch exceptions when trying to eject the SD card on Windows
CURA-106 #start-review
This commit is contained in:
parent
6eeb4c9e75
commit
3f1e5bb44a
1 changed files with 6 additions and 3 deletions
|
@ -88,10 +88,13 @@ class WindowsRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
||||||
|
|
||||||
result = None
|
result = None
|
||||||
# Then, try and tell it to eject
|
# Then, try and tell it to eject
|
||||||
|
try:
|
||||||
if not windll.kernel32.DeviceIoControl(handle, IOCTL_STORAGE_EJECT_MEDIA, None, None, None, None, None, None):
|
if not windll.kernel32.DeviceIoControl(handle, IOCTL_STORAGE_EJECT_MEDIA, None, None, None, None, None, None):
|
||||||
result = False
|
result = False
|
||||||
else:
|
else:
|
||||||
result = True
|
result = True
|
||||||
|
except Exception as e:
|
||||||
|
result = False
|
||||||
|
|
||||||
# Finally, close the handle
|
# Finally, close the handle
|
||||||
windll.kernel32.CloseHandle(handle)
|
windll.kernel32.CloseHandle(handle)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue