Remove test feature and hacks
This commit is contained in:
parent
79c30e9d59
commit
82288c6a3d
10 changed files with 4 additions and 50 deletions
|
|
@ -22,9 +22,6 @@ zellij-utils = { path = "zellij-utils/", version = "0.15.0" }
|
||||||
insta = { version = "1.6.0", features = ["backtrace"] }
|
insta = { version = "1.6.0", features = ["backtrace"] }
|
||||||
ssh2 = "0.9.1"
|
ssh2 = "0.9.1"
|
||||||
rand = "0.8.0"
|
rand = "0.8.0"
|
||||||
zellij-utils = { path = "zellij-utils/", version = "0.15.0", features = ["test"] }
|
|
||||||
zellij-client = { path = "zellij-client/", version = "0.15.0", features = ["test"] }
|
|
||||||
zellij-server = { path = "zellij-server/", version = "0.15.0", features = ["test"] }
|
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,3 @@ zellij-utils = { path = "../zellij-utils/", version = "0.15.0" }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "1.6.0"
|
insta = "1.6.0"
|
||||||
|
|
||||||
[features]
|
|
||||||
test = ["zellij-utils/test"]
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ pub fn start_client(
|
||||||
palette,
|
palette,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
let first_msg = match info {
|
let first_msg = match info {
|
||||||
ClientInfo::Attach(name, force, config_options) => {
|
ClientInfo::Attach(name, force, config_options) => {
|
||||||
SESSION_NAME.set(name).unwrap();
|
SESSION_NAME.set(name).unwrap();
|
||||||
|
|
@ -140,16 +139,6 @@ pub fn start_client(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#[cfg(any(feature = "test", test))]
|
|
||||||
let first_msg = {
|
|
||||||
let _ = SESSION_NAME.set("".into());
|
|
||||||
ClientToServerMsg::NewClient(
|
|
||||||
client_attributes,
|
|
||||||
Box::new(opts),
|
|
||||||
Box::new(config_options.clone()),
|
|
||||||
layout,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
os_input.connect_to_server(&*ZELLIJ_IPC_PIPE);
|
os_input.connect_to_server(&*ZELLIJ_IPC_PIPE);
|
||||||
os_input.send_to_server(first_msg);
|
os_input.send_to_server(first_msg);
|
||||||
|
|
@ -167,7 +156,6 @@ pub fn start_client(
|
||||||
> = channels::bounded(50);
|
> = channels::bounded(50);
|
||||||
let send_client_instructions = SenderWithContext::new(send_client_instructions);
|
let send_client_instructions = SenderWithContext::new(send_client_instructions);
|
||||||
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
std::panic::set_hook({
|
std::panic::set_hook({
|
||||||
use zellij_utils::errors::handle_panic;
|
use zellij_utils::errors::handle_panic;
|
||||||
let send_client_instructions = send_client_instructions.clone();
|
let send_client_instructions = send_client_instructions.clone();
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,3 @@ zellij-utils = { path = "../zellij-utils/", version = "0.15.0" }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "1.6.0"
|
insta = "1.6.0"
|
||||||
|
|
||||||
[features]
|
|
||||||
test = ["zellij-utils/test"]
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ pub(crate) enum SessionState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
daemonize::Daemonize::new()
|
daemonize::Daemonize::new()
|
||||||
.working_directory(std::env::current_dir().unwrap())
|
.working_directory(std::env::current_dir().unwrap())
|
||||||
.umask(0o077)
|
.umask(0o077)
|
||||||
|
|
@ -130,7 +129,6 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
let session_data: Arc<RwLock<Option<SessionMetaData>>> = Arc::new(RwLock::new(None));
|
let session_data: Arc<RwLock<Option<SessionMetaData>>> = Arc::new(RwLock::new(None));
|
||||||
let session_state = Arc::new(RwLock::new(SessionState::Uninitialized));
|
let session_state = Arc::new(RwLock::new(SessionState::Uninitialized));
|
||||||
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
std::panic::set_hook({
|
std::panic::set_hook({
|
||||||
use zellij_utils::errors::handle_panic;
|
use zellij_utils::errors::handle_panic;
|
||||||
let to_server = to_server.clone();
|
let to_server = to_server.clone();
|
||||||
|
|
@ -141,21 +139,6 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
|
|
||||||
let thread_handles = Arc::new(Mutex::new(Vec::new()));
|
let thread_handles = Arc::new(Mutex::new(Vec::new()));
|
||||||
|
|
||||||
#[cfg(any(feature = "test", test))]
|
|
||||||
thread_handles.lock().unwrap().push(
|
|
||||||
thread::Builder::new()
|
|
||||||
.name("server_router".to_string())
|
|
||||||
.spawn({
|
|
||||||
let session_data = session_data.clone();
|
|
||||||
let os_input = os_input.clone();
|
|
||||||
let to_server = to_server.clone();
|
|
||||||
let session_state = session_state.clone();
|
|
||||||
|
|
||||||
move || route_thread_main(session_data, session_state, os_input, to_server)
|
|
||||||
})
|
|
||||||
.unwrap(),
|
|
||||||
);
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
let _ = thread::Builder::new()
|
let _ = thread::Builder::new()
|
||||||
.name("server_listener".to_string())
|
.name("server_listener".to_string())
|
||||||
.spawn({
|
.spawn({
|
||||||
|
|
@ -306,7 +289,6 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.drain(..)
|
.drain(..)
|
||||||
.for_each(|h| drop(h.join()));
|
.for_each(|h| drop(h.join()));
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
drop(std::fs::remove_file(&socket_path));
|
drop(std::fs::remove_file(&socket_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1766,9 +1766,10 @@ impl Perform for Grid {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let result = debug_log_to_file(format!("Unhandled csi: {}->{:?}", c, params));
|
drop(debug_log_to_file(format!(
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
"Unhandled csi: {}->{:?}",
|
||||||
result.unwrap();
|
c, params
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,6 @@ impl TerminalPane {
|
||||||
pub fn read_buffer_as_lines(&self) -> Vec<Vec<TerminalCharacter>> {
|
pub fn read_buffer_as_lines(&self) -> Vec<Vec<TerminalCharacter>> {
|
||||||
self.grid.as_character_lines()
|
self.grid.as_character_lines()
|
||||||
}
|
}
|
||||||
#[cfg(any(feature = "test", test))]
|
|
||||||
pub fn cursor_coordinates(&self) -> Option<(usize, usize)> {
|
pub fn cursor_coordinates(&self) -> Option<(usize, usize)> {
|
||||||
// (x, y)
|
// (x, y)
|
||||||
self.grid.cursor_coordinates()
|
self.grid.cursor_coordinates()
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@ fn stream_terminal_bytes(
|
||||||
}
|
}
|
||||||
async_send_to_screen(senders.clone(), ScreenInstruction::Render).await;
|
async_send_to_screen(senders.clone(), ScreenInstruction::Render).await;
|
||||||
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
// this is a little hacky, and is because the tests end the file as soon as
|
// this is a little hacky, and is because the tests end the file as soon as
|
||||||
// we read everything, rather than hanging until there is new data
|
// we read everything, rather than hanging until there is new data
|
||||||
// a better solution would be to fix the test fakes, but this will do for now
|
// a better solution would be to fix the test fakes, but this will do for now
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,3 @@ features = ["unstable"]
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
|
|
||||||
[features]
|
|
||||||
test = []
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ const CONFIG_LOCATION: &str = ".config/zellij";
|
||||||
const CONFIG_NAME: &str = "config.yaml";
|
const CONFIG_NAME: &str = "config.yaml";
|
||||||
static ARROW_SEPARATOR: &str = "";
|
static ARROW_SEPARATOR: &str = "";
|
||||||
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
/// Goes through a predefined list and checks for an already
|
/// Goes through a predefined list and checks for an already
|
||||||
/// existing config directory, returns the first match
|
/// existing config directory, returns the first match
|
||||||
pub fn find_default_config_dir() -> Option<PathBuf> {
|
pub fn find_default_config_dir() -> Option<PathBuf> {
|
||||||
|
|
@ -23,11 +22,6 @@ pub fn find_default_config_dir() -> Option<PathBuf> {
|
||||||
.flatten()
|
.flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "test", test))]
|
|
||||||
pub fn find_default_config_dir() -> Option<PathBuf> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Order in which config directories are checked
|
/// Order in which config directories are checked
|
||||||
fn default_config_dirs() -> Vec<Option<PathBuf>> {
|
fn default_config_dirs() -> Vec<Option<PathBuf>> {
|
||||||
vec![
|
vec![
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue