From c5aca505822ba38ae7069e0a96fd7600c938bf3f Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 7 Mar 2022 21:50:52 -0500 Subject: [PATCH] Use BufWriter instead of File --- Cargo.toml | 1 + src/main.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1ca20af..8b9c55d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,4 @@ +cargo-features = ["strip"] [package] name = "kakutils-rs" version = "0.1.0" diff --git a/src/main.rs b/src/main.rs index 9d307d7..b1952b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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, KakMessage> { Ok(selections) } -pub fn open_command_fifo() -> Result { +pub fn open_command_fifo() -> Result, KakMessage> { OpenOptions::new() .write(true) .append(true) .open(&get_var("kak_command_fifo")?) + .map(BufWriter::new) .map_err(Into::into) }