diff options
| author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-07 16:50:58 +0530 |
|---|---|---|
| committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-07 16:50:58 +0530 |
| commit | 61e8d0915163e1c28fe688fa920058ded2745ade (patch) | |
| tree | 6c7ba82eee3c04678b09f2a2c9067b1cd3778661 /src | |
| parent | docs(changelog): update infra change (diff) | |
| download | sl0ppij-61e8d0915163e1c28fe688fa920058ded2745ade.tar.gz sl0ppij-61e8d0915163e1c28fe688fa920058ded2745ade.tar.xz sl0ppij-61e8d0915163e1c28fe688fa920058ded2745ade.zip | |
hotfix(logging): let logging fail silently while testing
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/panes/grid.rs | 4 | ||||
| -rw-r--r-- | src/common/utils/logging.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/client/panes/grid.rs b/src/client/panes/grid.rs index e893fd32..9d924220 100644 --- a/src/client/panes/grid.rs +++ b/src/client/panes/grid.rs @@ -1261,7 +1261,9 @@ impl vte::Perform for Grid { self.insert_character_at_cursor_position(EMPTY_TERMINAL_CHARACTER); } } else { - let _ = debug_log_to_file(format!("Unhandled csi: {}->{:?}", c, params)); + let result = debug_log_to_file(format!("Unhandled csi: {}->{:?}", c, params)); + #[cfg(not(test))] + result.unwrap(); } } diff --git a/src/common/utils/logging.rs b/src/common/utils/logging.rs index 4c53e2b2..0dd382d6 100644 --- a/src/common/utils/logging.rs +++ b/src/common/utils/logging.rs @@ -10,14 +10,12 @@ use std::{ use crate::os_input_output::set_permissions; use crate::utils::consts::{ZELLIJ_TMP_LOG_DIR, ZELLIJ_TMP_LOG_FILE}; -pub fn atomic_create_file(file_name: &Path) { +pub fn atomic_create_file(file_name: &Path) -> io::Result<()> { let _ = fs::OpenOptions::new() .append(true) .create(true) - .open(file_name) - .unwrap(); - #[cfg(not(test))] - set_permissions(file_name).unwrap(); + .open(file_name)?; + set_permissions(file_name) } pub fn atomic_create_dir(dir_name: &Path) -> io::Result<()> { @@ -42,7 +40,7 @@ pub fn debug_log_to_file(mut message: String) -> io::Result<()> { } pub fn debug_log_to_file_without_newline(message: String) -> io::Result<()> { - atomic_create_file(&*ZELLIJ_TMP_LOG_FILE); + atomic_create_file(&*ZELLIJ_TMP_LOG_FILE)?; let mut file = fs::OpenOptions::new() .append(true) .open(&*ZELLIJ_TMP_LOG_FILE)?; |
