Minor fixes
This commit is contained in:
parent
3326f521ef
commit
27634423d9
5 changed files with 9 additions and 18 deletions
|
|
@ -4,7 +4,6 @@ mod sessions;
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::install::populate_data_dir;
|
use crate::install::populate_data_dir;
|
||||||
use log::info;
|
|
||||||
use sessions::{assert_session, assert_session_ne, get_active_session, list_sessions};
|
use sessions::{assert_session, assert_session_ne, get_active_session, list_sessions};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
@ -21,7 +20,6 @@ use zellij_utils::{
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
configure_logger();
|
configure_logger();
|
||||||
info!("Starting Zellij!");
|
|
||||||
let opts = CliArgs::from_args();
|
let opts = CliArgs::from_args();
|
||||||
|
|
||||||
if let Some(Command::Sessions(Sessions::ListSessions)) = opts.command {
|
if let Some(Command::Sessions(Sessions::ListSessions)) = opts.command {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ pub fn start_client(
|
||||||
info: ClientInfo,
|
info: ClientInfo,
|
||||||
layout: Option<Layout>,
|
layout: Option<Layout>,
|
||||||
) {
|
) {
|
||||||
|
info!("Starting Zellij client!");
|
||||||
let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l";
|
let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l";
|
||||||
let take_snapshot = "\u{1b}[?1049h";
|
let take_snapshot = "\u{1b}[?1049h";
|
||||||
let bracketed_paste = "\u{1b}[?2004h";
|
let bracketed_paste = "\u{1b}[?2004h";
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ 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) {
|
||||||
info!("starts server");
|
info!("Starting Zellij server!");
|
||||||
daemonize::Daemonize::new()
|
daemonize::Daemonize::new()
|
||||||
.working_directory(std::env::current_dir().unwrap())
|
.working_directory(std::env::current_dir().unwrap())
|
||||||
.umask(0o077)
|
.umask(0o077)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::{
|
||||||
io::{Read, Seek, Write},
|
io::{Read, Seek, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::{debug, error, info};
|
use log::{debug, error};
|
||||||
use wasmer_wasi::{WasiFile, WasiFsError};
|
use wasmer_wasi::{WasiFile, WasiFsError};
|
||||||
use zellij_utils::serde;
|
use zellij_utils::serde;
|
||||||
|
|
||||||
|
|
@ -22,13 +22,6 @@ pub struct LoggingPipe {
|
||||||
|
|
||||||
impl LoggingPipe {
|
impl LoggingPipe {
|
||||||
pub fn new(plugin_name: &str, plugin_id: u32) -> LoggingPipe {
|
pub fn new(plugin_name: &str, plugin_id: u32) -> LoggingPipe {
|
||||||
info!(
|
|
||||||
"|{:<25.25}| {} [{:<10.15}] Creating decorating pipe for plugin: {}!",
|
|
||||||
plugin_name,
|
|
||||||
Local::now().format("%Y-%m-%d %H:%M:%S.%3f"),
|
|
||||||
format!("id: {}", plugin_id),
|
|
||||||
plugin_name
|
|
||||||
);
|
|
||||||
LoggingPipe {
|
LoggingPipe {
|
||||||
buffer: VecDeque::new(),
|
buffer: VecDeque::new(),
|
||||||
plugin_name: String::from(plugin_name),
|
plugin_name: String::from(plugin_name),
|
||||||
|
|
@ -49,11 +42,12 @@ impl LoggingPipe {
|
||||||
|
|
||||||
impl Read for LoggingPipe {
|
impl Read for LoggingPipe {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||||
|
// NOTE: should we do this? I think if anyone were to chain LoggingPipe and read from it,
|
||||||
|
// they would see very weird behavior because we drain self.buffer in `flush`. Also, logs would be screwed up.
|
||||||
|
// Consider removing this code.
|
||||||
let amt = std::cmp::min(buf.len(), self.buffer.len());
|
let amt = std::cmp::min(buf.len(), self.buffer.len());
|
||||||
for (i, byte) in self.buffer.drain(..amt).enumerate() {
|
let data: Vec<_> = self.buffer.drain(..amt).collect();
|
||||||
buf[i] = byte;
|
buf.as_mut().write(&data)
|
||||||
}
|
|
||||||
Ok(amt)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::{info, LevelFilter};
|
use log::LevelFilter;
|
||||||
|
|
||||||
use log4rs::append::file::FileAppender;
|
use log4rs::append::file::FileAppender;
|
||||||
use log4rs::config::{Appender, Config, Logger, Root};
|
use log4rs::config::{Appender, Config, Logger, Root};
|
||||||
|
|
@ -59,8 +59,6 @@ pub fn configure_logger() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let _ = log4rs::init_config(config).unwrap();
|
let _ = log4rs::init_config(config).unwrap();
|
||||||
|
|
||||||
info!("Zellij logger initialized");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn atomic_create_file(file_name: &Path) -> io::Result<()> {
|
pub fn atomic_create_file(file_name: &Path) -> io::Result<()> {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue