Make sure all except statements are no longer empty, should help a lot with debugging.
This commit is contained in:
@ -40,7 +40,9 @@ class Terminal:
|
||||
for y in lines:
|
||||
try:
|
||||
t = self.attributes[y]
|
||||
except:
|
||||
except Exception as e:
|
||||
# Terminal class doesn't have access to env, use fallback logging
|
||||
print(f'ptyDriver Terminal updateAttributes: Error accessing attributes: {e}')
|
||||
self.attributes.append([])
|
||||
|
||||
self.attributes[y] = [list(attribute[1:]) + [False, 'default', 'default'] for attribute in (buffer[y].values())]
|
||||
@ -135,7 +137,9 @@ class driver(screenDriver):
|
||||
try:
|
||||
if env["TERM"] == '':
|
||||
env["TERM"] = 'linux'
|
||||
except:
|
||||
except Exception as e:
|
||||
# Child process doesn't have access to env, use fallback logging
|
||||
print(f'ptyDriver spawnTerminal: Error checking TERM environment: {e}')
|
||||
env["TERM"] = 'linux'
|
||||
os.execvpe(argv[0], argv, env)
|
||||
# File-like object for I/O with the child process aka command.
|
||||
@ -184,7 +188,8 @@ class driver(screenDriver):
|
||||
if self.shortcutType == 'KEY':
|
||||
try:
|
||||
self.injectTextToScreen(msgBytes)
|
||||
except:
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('ptyDriver getInputData: Error injecting text to screen: ' + str(e), debug.debugLevel.ERROR)
|
||||
eventQueue.put({"Type":fenrirEventType.StopMainLoop,"Data":None})
|
||||
break
|
||||
else:
|
||||
|
@ -38,8 +38,8 @@ class driver(screenDriver):
|
||||
# set workaround for paste clipboard -> injectTextToScreen
|
||||
subprocess.run(['sysctl', 'dev.tty.legacy_tiocsti=1'],
|
||||
check=False, capture_output=True, timeout=5)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver shutdown: Error running fgconsole: ' + str(e), debug.debugLevel.ERROR)
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.env['runtime']['attributeManager'].appendDefaultAttributes([
|
||||
@ -105,7 +105,8 @@ class driver(screenDriver):
|
||||
file.seek(0)
|
||||
try:
|
||||
d = file.read()
|
||||
except:
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver getScreenText: Error reading file: ' + str(e), debug.debugLevel.ERROR)
|
||||
file.seek(0)
|
||||
while True:
|
||||
# Read from file
|
||||
@ -162,19 +163,19 @@ class driver(screenDriver):
|
||||
if currScreen != oldScreen:
|
||||
try:
|
||||
watchdog.unregister(vcsa[oldScreen])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver updateWatchdog: Error unregistering watchdog: ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver updateWatchdog: Error registering watchdog: ' + str(e), debug.debugLevel.ERROR)
|
||||
self.updateCharMap(currScreen)
|
||||
oldScreen = currScreen
|
||||
try:
|
||||
vcsa[currScreen].seek(0)
|
||||
lastScreenContent = self.readFile(vcsa[currScreen])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver updateWatchdog: Error reading screen content: ' + str(e), debug.debugLevel.ERROR)
|
||||
vcsuContent = None
|
||||
if useVCSU:
|
||||
vcsu[currScreen].seek(0)
|
||||
@ -233,23 +234,23 @@ class driver(screenDriver):
|
||||
try:
|
||||
if watchdog:
|
||||
watchdog.close()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver updateWatchdog: Error closing watchdog: ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
if tty:
|
||||
tty.close()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver shutdown: Error closing TTY: ' + str(e), debug.debugLevel.ERROR)
|
||||
for handle in vcsa.values():
|
||||
try:
|
||||
handle.close()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver shutdown: Error closing VCSA handle: ' + str(e), debug.debugLevel.ERROR)
|
||||
for handle in vcsu.values():
|
||||
try:
|
||||
handle.close()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver shutdown: Error closing VCSU handle: ' + str(e), debug.debugLevel.ERROR)
|
||||
|
||||
def createScreenEventData(self, screen, vcsaContent, vcsuContent = None):
|
||||
eventData = {
|
||||
@ -269,15 +270,15 @@ class driver(screenDriver):
|
||||
try:
|
||||
eventData['text'], eventData['attributes'] =\
|
||||
self.autoDecodeVCSA(vcsaContent[4:], eventData['lines'], eventData['columns'])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver createScreenEventData: Error decoding VCSA content: ' + str(e), debug.debugLevel.ERROR)
|
||||
# VCSU seems to give b' ' instead of b'\x00\x00\x00' (tsp), deactivated until its fixed
|
||||
if vcsuContent != None:
|
||||
try:
|
||||
vcsuContentAsText = vcsuContent.decode('UTF-32')
|
||||
eventData['text'] = screen_utils.insertNewlines(vcsuContentAsText, eventData['columns'])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver createScreenEventData: Error decoding VCSU content: ' + str(e), debug.debugLevel.ERROR)
|
||||
return eventData.copy()
|
||||
def updateCharMap(self, screen):
|
||||
self.charmap = {}
|
||||
@ -349,7 +350,8 @@ class driver(screenDriver):
|
||||
try:
|
||||
if sh & self.hichar:
|
||||
ch |= 0x100
|
||||
except:
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver autoDecodeVCSA: Error processing character: ' + str(e), debug.debugLevel.ERROR)
|
||||
ch = None
|
||||
if self.hichar == 0x100:
|
||||
attr >>= 1
|
||||
@ -364,8 +366,8 @@ class driver(screenDriver):
|
||||
bold = 1
|
||||
#if (ink != 7) or (paper != 0):
|
||||
# print(ink,paper)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('vcsaDriver autoDecodeVCSA: Error processing attributes: ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
lineText += self.charmap[ch]
|
||||
except KeyError:
|
||||
|
Reference in New Issue
Block a user