Merge pull request #19 from dedan/fix_editor_not_saved

don't crash if editor file was not saved (treat it as read mode) close #12
This commit is contained in:
Manuel Ebert 2012-04-26 04:52:16 -07:00
commit 5a096ccd54

View file

@ -404,12 +404,16 @@ if __name__ == "__main__":
if config['editor']:
tmpfile = os.path.join(tempfile.gettempdir(), "jrnl")
subprocess.call(config['editor'].split() + [tmpfile])
if os.path.exists(tmpfile):
with open(tmpfile) as f:
raw = f.read()
os.remove(tmpfile)
else:
print('nothing saved to file')
raw = ''
else:
raw = raw_input("Compose Entry: ")
if raw:
args.text = [raw]
else: