From c6c89d97f8a6c423e6e24404e2178126498c7b09 Mon Sep 17 00:00:00 2001 From: naglis <827324+naglis@users.noreply.github.com> Date: Sat, 6 Jan 2024 09:58:37 +0200 Subject: [PATCH] Improve test daemon logging - Pass `--verbose` so MPD outputs verbose logs (e.g. messages of interaction with the client), which can be useful in case of a test failure. - Pass `--stderr` so that MPD outputs all messages to stderr, which is what we capture. - Drop `log_file "/dev/null"` directive from config, since we want to capture the logs from stderr. - Use standard macro braces. --- tests/helpers/daemon.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/helpers/daemon.rs b/tests/helpers/daemon.rs index 0ef2d277..2d6866dc 100644 --- a/tests/helpers/daemon.rs +++ b/tests/helpers/daemon.rs @@ -35,7 +35,6 @@ impl MpdConfig { format!( r#" db_file "{db_file}" -log_file "/dev/null" music_directory "{music_directory}" playlist_directory "{playlist_directory}" sticker_file "{sticker_file}" @@ -76,8 +75,7 @@ impl Drop for Daemon { if let Some(ref mut stderr) = self.process.stderr { let mut output = String::new(); stderr.read_to_string(&mut output).expect("Could not collect output from mpd."); - println! {"Output from mpd:"} - println! {"{}", output}; + println!("Output from mpd:\n{output}"); } } } @@ -101,6 +99,8 @@ impl Daemon { let process = Command::new("mpd") .arg("--no-daemon") + .arg("--verbose") + .arg("--stderr") .arg(&config.config_path) .stdin(Stdio::null()) .stdout(Stdio::null())