mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Close temp file before deleting it.
This commit is contained in:
parent
0d1b381bd1
commit
01a7f660f3
1 changed files with 2 additions and 1 deletions
|
@ -125,9 +125,10 @@ def get_text_from_editor(config, template=""):
|
||||||
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
||||||
if template:
|
if template:
|
||||||
f.write(template)
|
f.write(template)
|
||||||
subprocess.call(config['editor'].split() + [tmpfile])
|
subprocess.call(config['editor'].split() + [tmpfile])
|
||||||
with codecs.open(tmpfile, "r", "utf-8") as f:
|
with codecs.open(tmpfile, "r", "utf-8") as f:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
|
os.close(_);
|
||||||
os.remove(tmpfile)
|
os.remove(tmpfile)
|
||||||
if not raw:
|
if not raw:
|
||||||
prompt('[Nothing saved to file]')
|
prompt('[Nothing saved to file]')
|
||||||
|
|
Loading…
Add table
Reference in a new issue