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] [package]
name = "kakutils-rs" name = "kakutils-rs"
version = "0.1.0" version = "0.1.0"

View File

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