Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions src/packages/buskill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ def close(self):
print( msg ); logger.debug( msg )

self.usb_handler.join()
except:
pass
except Exception as e:
logger.debug("Failed to join usb_handler: %s", e)
try:

# if we don't kill this child process on exit, the UI will freeze
Expand All @@ -489,14 +489,14 @@ def close(self):
print( msg ); logger.debug( msg )

self.upgrade_process.join()
except:
pass
except Exception as e:
logger.debug("Failed to join upgrade_process: %s", e)

try:
# delete cache dir
self.wipeCache()
except:
pass
except Exception as e:
logger.debug("Failed to wipe cache: %s", e)

def is_platform_supported(self):

Expand Down Expand Up @@ -892,8 +892,8 @@ def setupDataDir(self):
try:
msg = "INFO: using DATA_DIR:|" +str(self.DATA_DIR)+ "|"
print( msg ); logger.info( msg )
except:
msg = "WARNING: Unable to write to any DATA_DIR; not using one"
except Exception as e:
logger.warning("Unable to write to any DATA_DIR: %s", e)
print( msg ); logger.warn( msg )
self.DATA_DIR = ''
return
Expand Down Expand Up @@ -932,8 +932,8 @@ def toggle(self):
try:
self.usb_handler.kill()
self.usb_handler.join()
except:
pass
except Exception as e:
logger.debug("Failed to kill/join usb_handler: %s", e)

self.is_armed = False
msg = "INFO: BusKill is disarmed."
Expand Down Expand Up @@ -1598,17 +1598,17 @@ def wipeCache(self):
dmg_mnt_path = os.path.join( self.CACHE_DIR, 'dmg_mnt' )
if os.path.exists( dmg_mnt_path ) and self.OS_NAME_SHORT == 'mac':
subprocess.run( ['umount', dmg_mnt_path] )
except:
pass
except Exception as e:
logger.debug("Failed to unmount dmg: %s", e)

if os.path.exists( self.CACHE_DIR ):
shutil.rmtree( self.CACHE_DIR )

try:
os.makedirs( self.CACHE_DIR, mode=0o700 )
os.chmod( self.DATA_DIR, mode=0o0700 )
except:
pass
except Exception as e:
logger.debug("Failed to create/chmod cache dir: %s", e)

# Takes the path (as a string) to a SHA256SUMS file and a list of paths to
# local files. Returns true only if all files' checksums are present in the
Expand Down Expand Up @@ -1864,7 +1864,8 @@ def upgrade(self):
try:
with open( os.path.join(APP_DIR, 'KEYS'), 'r' ) as fd:
KEYS = fd.read()
except:
except Exception as e:
logger.debug("Failed to read KEYS from APP_DIR, trying parent dir: %s", e)
# fall-back to one dir up if we're executing from 'src/'
with open( os.path.join( os.path.split(APP_DIR)[0], 'KEYS'), 'r' ) as fd:
KEYS = fd.read()
Expand Down
Loading