Add required flushes

This commit is contained in:
Austen Adler 2022-03-07 21:54:10 -05:00
parent c5aca50582
commit 378622a00f
5 changed files with 7 additions and 1 deletions

View File

@ -146,6 +146,7 @@ fn send_message(msg: &KakMessage) -> Result<(), Box<dyn std::error::Error>> {
if let Some(debug_msg_str) = &msg.1 { if let Some(debug_msg_str) = &msg.1 {
write!(f, "echo -debug '{}';", debug_msg_str.replace('\'', "''"))?; write!(f, "echo -debug '{}';", debug_msg_str.replace('\'', "''"))?;
} }
f.flush()?;
} }
Ok(()) Ok(())
} }
@ -169,7 +170,8 @@ fn run() -> Result<KakMessage, KakMessage> {
pub fn kak_exec(cmd: &str) -> Result<(), KakMessage> { pub fn kak_exec(cmd: &str) -> Result<(), KakMessage> {
let mut f = open_command_fifo()?; let mut f = open_command_fifo()?;
write!(f, "{}", cmd).map_err(Into::into) write!(f, "{}", cmd)?;
f.flush().map_err(Into::into)
} }
pub fn kak_response(msg: &str) -> Result<Vec<String>, KakMessage> { pub fn kak_response(msg: &str) -> Result<Vec<String>, KakMessage> {

View File

@ -36,6 +36,7 @@ pub fn math_eval(_options: &Options) -> Result<KakMessage, KakMessage> {
write!(f, " '{}'", new_selection.as_deref().unwrap_or(""))?; write!(f, " '{}'", new_selection.as_deref().unwrap_or(""))?;
} }
write!(f, " ; exec R;")?; write!(f, " ; exec R;")?;
f.flush()?;
Ok(KakMessage( Ok(KakMessage(
format!("MathEval {} selections", selections.len()), format!("MathEval {} selections", selections.len()),

View File

@ -17,6 +17,7 @@ pub fn shuf(_options: &Options) -> Result<KakMessage, KakMessage> {
write!(f, " '{}'", new_selection)?; write!(f, " '{}'", new_selection)?;
} }
write!(f, " ; exec R;")?; write!(f, " ; exec R;")?;
f.flush()?;
Ok(KakMessage( Ok(KakMessage(
format!("Shuf {} selections", selections.len()), format!("Shuf {} selections", selections.len()),

View File

@ -190,6 +190,7 @@ pub fn sort(options: &Options) -> Result<KakMessage, KakMessage> {
write!(f, " '{}'", new_selection)?; write!(f, " '{}'", new_selection)?;
} }
write!(f, " ; exec R;")?; write!(f, " ; exec R;")?;
f.flush()?;
Ok(KakMessage( Ok(KakMessage(
format!("Sorted {} selections", zipped.len()), format!("Sorted {} selections", zipped.len()),

View File

@ -47,6 +47,7 @@ pub fn uniq(options: &Options) -> Result<KakMessage, KakMessage> {
write!(f, " '{}'", new_selection)?; write!(f, " '{}'", new_selection)?;
} }
write!(f, " ; exec R;")?; write!(f, " ; exec R;")?;
f.flush()?;
Ok(KakMessage( Ok(KakMessage(
format!("Uniq {} selections", selections.len()), format!("Uniq {} selections", selections.len()),