diff --git a/editor.py b/editor.py index 39cc942..712a532 100755 --- a/editor.py +++ b/editor.py @@ -85,7 +85,7 @@ def get_tty_filename(): return '/dev/tty' -def edit(filename=None, contents=None, use_tty=None, suffix=''): +def edit(filename=None, contents=None, use_tty=None, suffix='', read_file=True): editor = get_editor() args = [editor] + get_editor_args(os.path.basename(os.path.realpath(editor))) @@ -113,8 +113,9 @@ def edit(filename=None, contents=None, use_tty=None, suffix=''): proc = subprocess.Popen(args, close_fds=True, stdout=stdout) proc.communicate() - with open(filename, mode='rb') as f: - return f.read() + if read_file: + with open(filename, mode='rb') as f: + return f.read() def _get_editor(ns):