diff options
| author | Brooks Rady <b.j.rady@gmail.com> | 2020-12-02 14:03:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-02 15:03:46 +0100 |
| commit | c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea (patch) | |
| tree | 699f8bfb9f3fb3898b449b43bf6bb53278a443ea /src/utils | |
| parent | fic(compatibility): htop scrolling issues (#77) (diff) | |
| download | sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.tar.gz sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.tar.xz sl0ppij-c3fa9fb40e3cb0146169841e5a8a14f4e6ae2fea.zip | |
fix(threads): a race condition, build-times, and warnings (#79)
* Fix a race condition, build-times, and warnings
* Yeah, yeah... I know
* style(code): add comment to explain race condition
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/logging.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/utils/logging.rs b/src/utils/logging.rs index e175050e..fa302b09 100644 --- a/src/utils/logging.rs +++ b/src/utils/logging.rs @@ -23,14 +23,9 @@ pub fn atomic_create_dir(dir_name: &str) -> io::Result<()> { } } -pub fn debug_log_to_file(message: String) -> io::Result<()> { - atomic_create_file(MOSAIC_TMP_LOG_FILE); - let mut file = fs::OpenOptions::new() - .append(true) - .create(true) - .open(MOSAIC_TMP_LOG_FILE)?; - file.write_all(message.as_bytes())?; - file.write_all(b"\n") +pub fn debug_log_to_file(mut message: String) -> io::Result<()> { + message.push('\n'); + debug_log_to_file_without_newline(message) } pub fn debug_log_to_file_without_newline(message: String) -> io::Result<()> { @@ -39,9 +34,7 @@ pub fn debug_log_to_file_without_newline(message: String) -> io::Result<()> { .append(true) .create(true) .open(MOSAIC_TMP_LOG_FILE)?; - file.write_all(message.as_bytes())?; - - Ok(()) + file.write_all(message.as_bytes()) } pub fn debug_log_to_file_pid_0(message: String, pid: RawFd) -> io::Result<()> { |
