@@ -3,10 +3,10 @@ extern crate tempdir;
33use self :: tempdir:: TempDir ;
44use super :: mpd;
55use std:: fs:: { File , create_dir} ;
6- use std:: io:: Write ;
6+ use std:: io:: { Write , Read } ;
77use std:: os:: unix:: net:: UnixStream ;
88use std:: path:: { Path , PathBuf } ;
9- use std:: process:: { Command , Child } ;
9+ use std:: process:: { Command , Child , Stdio } ;
1010
1111struct MpdConfig {
1212 db_file : PathBuf ,
@@ -68,6 +68,12 @@ impl Drop for Daemon {
6868 fn drop ( & mut self ) {
6969 self . process . kill ( ) . expect ( "Could not kill mpd daemon." ) ;
7070 self . process . wait ( ) . expect ( "Could not wait for mpd daemon to shutdown." ) ;
71+ if let Some ( ref mut stderr) = self . process . stderr {
72+ let mut output = String :: new ( ) ;
73+ stderr. read_to_string ( & mut output) . expect ( "Could not collect output from mpd." ) ;
74+ println ! { "Output from mpd:" }
75+ println ! { "{}" , output} ;
76+ }
7177 }
7278}
7379
@@ -85,6 +91,9 @@ impl Daemon {
8591 let process = Command :: new ( "mpd" )
8692 . arg ( "--no-daemon" )
8793 . arg ( & config. config_path )
94+ . stdin ( Stdio :: null ( ) )
95+ . stdout ( Stdio :: null ( ) )
96+ . stderr ( Stdio :: piped ( ) )
8897 . spawn ( )
8998 . expect ( "Could not create mpd daemon." ) ;
9099
0 commit comments