Merge pull request #834 from Stebalien/master
Don't re-open temporary file.
This commit is contained in:
commit
1db063f334
1 changed files with 1 additions and 2 deletions
|
@ -27,9 +27,8 @@ use std::io::Error as IOError;
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
pub fn edit_in_tmpfile_with_command(mut cmd: Command, s: &mut String) -> Result<bool, IOError> {
|
pub fn edit_in_tmpfile_with_command(mut cmd: Command, s: &mut String) -> Result<bool, IOError> {
|
||||||
let file = try!(NamedTempFile::new());
|
let mut file = &try!(NamedTempFile::new());
|
||||||
let file_path = file.path();
|
let file_path = file.path();
|
||||||
let mut file = try!(file.reopen());
|
|
||||||
|
|
||||||
try!(file.write_all(&s.clone().into_bytes()[..]));
|
try!(file.write_all(&s.clone().into_bytes()[..]));
|
||||||
try!(file.sync_data());
|
try!(file.sync_data());
|
||||||
|
|
Loading…
Reference in a new issue