mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 14:06:14 +02:00
Touch tmpfiles before opening
This commit is contained in:
parent
534dc63ec0
commit
01703af728
4 changed files with 20 additions and 8 deletions
|
@ -7,7 +7,7 @@ jrnl is a simple journal application for your command line.
|
|||
"""
|
||||
|
||||
__title__ = 'jrnl'
|
||||
__version__ = '1.7.2'
|
||||
__version__ = '1.7.3'
|
||||
__author__ = 'Manuel Ebert'
|
||||
__license__ = 'MIT License'
|
||||
__copyright__ = 'Copyright 2013 Manuel Ebert'
|
||||
|
|
13
jrnl/util.py
13
jrnl/util.py
|
@ -129,14 +129,13 @@ def get_text_from_editor(config, template=""):
|
|||
if template:
|
||||
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
||||
f.write(template)
|
||||
with open(tmpfile, 'w'):
|
||||
pass
|
||||
subprocess.call(config['editor'].split() + [tmpfile])
|
||||
if os.path.exists(tmpfile):
|
||||
with codecs.open(tmpfile, "r", "utf-8") as f:
|
||||
raw = f.read()
|
||||
os.remove(tmpfile)
|
||||
else:
|
||||
with codecs.open(tmpfile, "r", "utf-8") as f:
|
||||
raw = f.read()
|
||||
os.remove(tmpfile)
|
||||
if not raw:
|
||||
prompt('[Nothing saved to file]')
|
||||
raw = ''
|
||||
|
||||
return raw
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue