Use BufWriter instead of File

This commit is contained in:
Austen Adler 2022-03-07 21:50:52 -05:00
parent 2e2fdb200d
commit c5aca50582
2 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,4 @@
cargo-features = ["strip"]
[package]
name = "kakutils-rs"
version = "0.1.0"

View File

@ -20,7 +20,7 @@ use std::{
convert::Into,
env, fs,
fs::{File, OpenOptions},
io::Write,
io::{BufWriter, Write},
str::FromStr,
};
@ -183,11 +183,12 @@ pub fn kak_response(msg: &str) -> Result<Vec<String>, KakMessage> {
Ok(selections)
}
pub fn open_command_fifo() -> Result<File, KakMessage> {
pub fn open_command_fifo() -> Result<BufWriter<File>, KakMessage> {
OpenOptions::new()
.write(true)
.append(true)
.open(&get_var("kak_command_fifo")?)
.map(BufWriter::new)
.map_err(Into::into)
}