Permalink
Browse files

Close file handle for better windows compatibility.

  Closes GH-7.
  • Loading branch information...
1 parent 7fe641e commit b7c5cba7ed83bae58e9b67b6368a4b1a1aa203c6 @jberkel committed Mar 11, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/interactive_editor.rb
@@ -40,11 +40,11 @@ def edit(object, file=nil)
args = Shellwords.shellwords(@editor) #parse @editor as arguments could be complex
args << current_file.path
+ current_file.close rescue nil
Exec.system(*args)
if object
- return object unless File.exists?(current_file)
- YAML::load( File.open(current_file) )
+ File.exists?(current_file.path) ? YAML.load_file(current_file.path) : object
elsif mtime < File.stat(@file.path).mtime
execute
end

0 comments on commit b7c5cba

Please sign in to comment.