@@ -3,10 +3,10 @@ extern crate tempdir;
3
3
use self :: tempdir:: TempDir ;
4
4
use super :: mpd;
5
5
use std:: fs:: { File , create_dir} ;
6
- use std:: io:: Write ;
6
+ use std:: io:: { Write , Read } ;
7
7
use std:: os:: unix:: net:: UnixStream ;
8
8
use std:: path:: { Path , PathBuf } ;
9
- use std:: process:: { Command , Child } ;
9
+ use std:: process:: { Command , Child , Stdio } ;
10
10
11
11
struct MpdConfig {
12
12
db_file : PathBuf ,
@@ -68,6 +68,12 @@ impl Drop for Daemon {
68
68
fn drop ( & mut self ) {
69
69
self . process . kill ( ) . expect ( "Could not kill mpd daemon." ) ;
70
70
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
+ }
71
77
}
72
78
}
73
79
@@ -85,6 +91,9 @@ impl Daemon {
85
91
let process = Command :: new ( "mpd" )
86
92
. arg ( "--no-daemon" )
87
93
. arg ( & config. config_path )
94
+ . stdin ( Stdio :: null ( ) )
95
+ . stdout ( Stdio :: null ( ) )
96
+ . stderr ( Stdio :: piped ( ) )
88
97
. spawn ( )
89
98
. expect ( "Could not create mpd daemon." ) ;
90
99
0 commit comments