Fix exceptions when using -p option

This commit is contained in:
Aaron Heise 2023-02-11 22:25:48 -06:00
parent 0b7fd9cedd
commit 5860317743
2 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "rnsh" name = "rnsh"
version = "0.0.1" version = "0.0.2"
description = "Shell over Reticulum" description = "Shell over Reticulum"
authors = ["acehoss <acehoss@acehoss.net>"] authors = ["acehoss <acehoss@acehoss.net>"]
license = "MIT" license = "MIT"

View File

@ -107,13 +107,15 @@ def _rns_log(msg, level=3, _override_destination=False):
def _rns_log_inner(): def _rns_log_inner():
nonlocal msg, level, _override_destination nonlocal msg, level, _override_destination
try:
with process.TTYRestorer(sys.stdin.fileno()) as tr: with process.TTYRestorer(sys.stdin.fileno()) as tr:
with exception.permit(SystemExit):
attr = tr.current_attr() attr = tr.current_attr()
attr[process.TTYRestorer.ATTR_IDX_OFLAG] = attr[process.TTYRestorer.ATTR_IDX_OFLAG] | \ attr[process.TTYRestorer.ATTR_IDX_OFLAG] = attr[process.TTYRestorer.ATTR_IDX_OFLAG] | \
termios.ONLRET | termios.ONLCR | termios.OPOST termios.ONLRET | termios.ONLCR | termios.OPOST
tr.set_attr(attr) tr.set_attr(attr)
_rns_log_orig(msg, level, _override_destination) _rns_log_orig(msg, level, _override_destination)
except ValueError:
_rns_log_orig(msg, level, _override_destination)
try: try:
if _loop: if _loop: