mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Fix absolute editor path windows bug
This commit is contained in:
parent
c155bafa84
commit
1e00ef73eb
1 changed files with 7 additions and 2 deletions
|
@ -11,7 +11,6 @@ from .color import ERROR_COLOR
|
||||||
from .color import RESET_COLOR
|
from .color import RESET_COLOR
|
||||||
from .os_compat import on_windows
|
from .os_compat import on_windows
|
||||||
|
|
||||||
|
|
||||||
def get_text_from_editor(config, template=""):
|
def get_text_from_editor(config, template=""):
|
||||||
suffix = ".jrnl"
|
suffix = ".jrnl"
|
||||||
if config["template"]:
|
if config["template"]:
|
||||||
|
@ -25,7 +24,13 @@ def get_text_from_editor(config, template=""):
|
||||||
f.write(template)
|
f.write(template)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.call(shlex.split(config["editor"], posix=on_windows) + [tmpfile])
|
# https://stackoverflow.com/questions/33560364/python-windows-parsing-command-lines-with-shlex
|
||||||
|
# https://bugs.python.org/issue1724822
|
||||||
|
if on_windows:
|
||||||
|
parsed_editor_path = config["editor"] + tmpfile
|
||||||
|
else:
|
||||||
|
parsed_editor_path = shlex.split(config["editor"]) + [tmpfile]
|
||||||
|
subprocess.call(parsed_editor_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = f"""
|
error_msg = f"""
|
||||||
{ERROR_COLOR}{str(e)}{RESET_COLOR}
|
{ERROR_COLOR}{str(e)}{RESET_COLOR}
|
||||||
|
|
Loading…
Add table
Reference in a new issue