mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 22:56:15 +01:00
- more helpful error message if osc cannot run the pager/editor
This commit is contained in:
parent
828bb264ca
commit
24d5b4218a
@ -141,6 +141,10 @@ def run(prg):
|
||||
print >>sys.stderr, e
|
||||
return 2
|
||||
|
||||
except oscerr.RuntimeError, e:
|
||||
print >>sys.stderr, e.msg
|
||||
return 1
|
||||
|
||||
except oscerr.WorkingCopyOutdated, e:
|
||||
print >>sys.stderr, e
|
||||
return 1
|
||||
|
15
osc/core.py
15
osc/core.py
@ -2621,15 +2621,22 @@ def run_pager(message):
|
||||
tmpfile.write(message)
|
||||
tmpfile.flush()
|
||||
pager = os.getenv('PAGER', default=get_default_pager())
|
||||
subprocess.call('%s %s' % (pager, tmpfile.name), shell=True)
|
||||
tmpfile.close()
|
||||
try:
|
||||
try:
|
||||
subprocess.call('%s %s' % (pager, tmpfile.name), shell=True)
|
||||
except OSError, e:
|
||||
raise oscerr.RuntimeError('cannot run pager \'%s\': %s' % (pager, e.strerror), pager)
|
||||
finally:
|
||||
tmpfile.close()
|
||||
|
||||
def run_editor(filename):
|
||||
editor = os.getenv('EDITOR', default=get_default_editor())
|
||||
cmd = editor.split(' ')
|
||||
cmd.append(filename)
|
||||
|
||||
return subprocess.call(cmd)
|
||||
try:
|
||||
return subprocess.call(cmd)
|
||||
except OSError, e:
|
||||
raise oscerr.RuntimeError('cannot run editor \'%s\': %s' % (editor, e.strerror), editor)
|
||||
|
||||
def edit_message(footer='', template='', templatelen=30):
|
||||
delim = '--This line, and those below, will be ignored--\n'
|
||||
|
Loading…
Reference in New Issue
Block a user