aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/utils
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2021-05-07 16:50:58 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2021-05-07 16:50:58 +0530
commit61e8d0915163e1c28fe688fa920058ded2745ade (patch)
tree6c7ba82eee3c04678b09f2a2c9067b1cd3778661 /src/common/utils
parentdocs(changelog): update infra change (diff)
downloadsl0ppij-61e8d0915163e1c28fe688fa920058ded2745ade.tar.gz
sl0ppij-61e8d0915163e1c28fe688fa920058ded2745ade.tar.xz
sl0ppij-61e8d0915163e1c28fe688fa920058ded2745ade.zip
hotfix(logging): let logging fail silently while testing
Diffstat (limited to 'src/common/utils')
-rw-r--r--src/common/utils/logging.rs10
1 files changed, 4 insertions, 6 deletions
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)?;