refactor all write_alls to ensure flushing (#5567)

This commit is contained in:
Darren Schroeder
2022-05-17 13:28:18 -05:00
committed by GitHub
parent f26d3bf8d7
commit f0cb2f38df
14 changed files with 85 additions and 85 deletions

View File

@ -1,23 +1,20 @@
use super::{Command, EnvVars, Stack};
use crate::Value;
use crate::{
ast::Block, AliasId, BlockId, Config, DeclId, Example, Module, ModuleId, OverlayId, ShellError,
Signature, Span, Type, VarId, Variable,
};
use core::panic;
use std::borrow::Borrow;
use std::collections::HashSet;
use std::path::Path;
#[cfg(feature = "plugin")]
use std::path::PathBuf;
use std::{
collections::HashMap,
sync::{atomic::AtomicBool, Arc},
};
use crate::Value;
use std::borrow::Borrow;
use std::collections::HashSet;
use std::path::Path;
#[cfg(feature = "plugin")]
use std::path::PathBuf;
static PWD_ENV: &str = "PWD";
pub static DEFAULT_OVERLAY_NAME: &str = "zero";
@ -651,6 +648,17 @@ impl EngineState {
.write_all(line.as_bytes())
.map_err(|err| ShellError::PluginFailedToLoad(err.to_string()))
})
.and_then(|_| {
plugin_file.flush().map_err(|err| {
ShellError::GenericError(
"Error flushing plugin file".to_string(),
format! {"{}", err},
None,
None,
Vec::new(),
)
})
})
})
})
}