mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 09:16:14 +01:00
- core: added new _editor_command function
Used by "run_editor" and "_edit_message_open_editor" to retrieve the editor command.
This commit is contained in:
parent
132a2d128f
commit
aacbf6a03b
10
osc/core.py
10
osc/core.py
@ -3480,18 +3480,22 @@ def run_pager(message, tmp_suffix=''):
|
||||
tmpfile.close()
|
||||
|
||||
def run_editor(filename):
|
||||
cmd = _editor_command()
|
||||
cmd.append(filename)
|
||||
return run_external(cmd[0], *cmd[1:])
|
||||
|
||||
def _editor_command():
|
||||
editor = os.getenv('EDITOR', default=get_default_editor())
|
||||
try:
|
||||
cmd = shlex.split(editor)
|
||||
except SyntaxError:
|
||||
cmd = editor.split()
|
||||
cmd.append(filename)
|
||||
return run_external(cmd[0], *cmd[1:])
|
||||
return cmd
|
||||
|
||||
def _edit_message_open_editor(filename, data, orig_mtime):
|
||||
# FIXME: import modules globally
|
||||
import tempfile
|
||||
editor = os.getenv('EDITOR', default=get_default_editor()).split(' ')
|
||||
editor = _editor_command()
|
||||
mtime = os.stat(filename).st_mtime
|
||||
if mtime == orig_mtime:
|
||||
# prepare file for editors
|
||||
|
Loading…
Reference in New Issue
Block a user