diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-08-29 12:23:31 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-08-29 12:30:24 +0200 |
commit | 3beecafc2cae86290a191c1e841be13f5b08795d (patch) | |
tree | 2da9f983d441f1f97c6927b6a7f3886924d7685a /lib/reline | |
parent | e8c3872555fc85640505974e6b1c39d315572689 (diff) |
Fix usages of Tempfile.open(&block) that expected the file to still be there after the block
Diffstat (limited to 'lib/reline')
-rw-r--r-- | lib/reline/line_editor.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index b4d2b457c7..6826d58d9a 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -2079,12 +2079,14 @@ class Reline::LineEditor end private def vi_histedit(key) - path = Tempfile.open { |fp| + Tempfile.open { |fp| fp.write @line - fp.path + path = fp.path + fp.close + + system("#{ENV['EDITOR']} #{path}") + @line = File.read(path) } - system("#{ENV['EDITOR']} #{path}") - @line = File.read(path) finish end |