Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExternalCommand: Fix unbound variables. #1628

Merged
merged 1 commit into from
Sep 28, 2023
Merged
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
6 changes: 4 additions & 2 deletions alot/commands/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ async def apply(self, ui):

logging.info('calling external command: %s', self.cmdlist)

err = None
proc = None
ret = ''
# TODO: these can probably be refactored in terms of helper.call_cmd
# and helper.call_cmd_async
Expand Down Expand Up @@ -300,7 +302,7 @@ async def apply(self, ui):
ret = str(e)
else:
_, err = proc.communicate(stdin.read() if stdin else None)
if proc.returncode == 0:
if proc and proc.returncode == 0:
ret = 'success'
elif err:
ret = err.decode(urwid.util.detected_encoding)
Expand All @@ -310,7 +312,7 @@ async def apply(self, ui):
self.on_success()
else:
msg = "editor has exited with error code {} -- {}".format(
proc.returncode,
"None" if proc is None else proc.returncode,
ret or "No stderr output")
ui.notify(msg, priority='error')
if self.refocus and callerbuffer in ui.buffers:
Expand Down