Skip to content

Commit fa3ad3a

Browse files
committed
Display exception from subprocess
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent bdc1281 commit fa3ad3a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

bpython/repl.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,7 @@ def open_in_external_editor(self, filename):
10011001
editor_args = shlex.split(prepare_for_exec(self.config.editor,
10021002
encoding))
10031003
args = editor_args + [prepare_for_exec(filename, encoding)]
1004-
if subprocess.call(args) == 0:
1005-
return True
1006-
return False
1004+
return subprocess.call(args) == 0:
10071005

10081006
def edit_config(self):
10091007
if not (os.path.isfile(self.config.config_path)):
@@ -1028,11 +1026,12 @@ def edit_config(self):
10281026
else:
10291027
return False
10301028

1031-
if self.open_in_external_editor(self.config.config_path):
1032-
self.interact.notify(_('bpython config file edited. Restart '
1033-
'bpython for changes to take effect.'))
1034-
else:
1035-
self.interact.notify(_('Error editing config file.'))
1029+
try:
1030+
if self.open_in_external_editor(self.config.config_path):
1031+
self.interact.notify(_('bpython config file edited. Restart '
1032+
'bpython for changes to take effect.'))
1033+
except OSError as e:
1034+
self.interact.notify(_('Error editing config file: %s') % e)
10361035

10371036

10381037
def next_indentation(line, tab_length):

0 commit comments

Comments
 (0)