Show a nice error message when execing() the child fails

This commit is contained in:
Kovid Goyal 2016-11-03 19:28:57 +05:30
parent a045f4f0e6
commit 0e4b846590

View file

@ -68,7 +68,12 @@ def fork_child(argv, cwd, opts):
os.environ['COLORTERM'] = 'truecolor'
if os.path.isdir(terminfo_dir):
os.environ['TERMINFO'] = terminfo_dir
os.execvp(argv[0], argv)
try:
os.execvp(argv[0], argv)
except Exception as err:
print('Could not launch:', argv[0])
print('\t', err)
input('\nPress Enter to exit:')
else:
os.close(slave)
fork_child.pid = pid