@@ -62,43 +62,44 @@ impl<'a> From<&'a mut Command> for BootstrapCommand<'a> {
6262
6363/// Represents the output of an executed process.
6464#[ allow( unused) ]
65- #[ derive( Default ) ]
66- pub struct CommandOutput {
67- status : ExitStatus ,
68- stdout : Vec < u8 > ,
69- stderr : Vec < u8 > ,
70- }
65+ pub struct CommandOutput ( Output ) ;
7166
7267impl CommandOutput {
7368 pub fn is_success ( & self ) -> bool {
74- self . status . success ( )
69+ self . 0 . status . success ( )
7570 }
7671
7772 pub fn is_failure ( & self ) -> bool {
7873 !self . is_success ( )
7974 }
8075
8176 pub fn status ( & self ) -> ExitStatus {
82- self . status
77+ self . 0 . status
8378 }
8479
8580 pub fn stdout ( & self ) -> String {
86- String :: from_utf8 ( self . stdout . clone ( ) ) . expect ( "Cannot parse process stdout as UTF-8" )
81+ String :: from_utf8 ( self . 0 . stdout . clone ( ) ) . expect ( "Cannot parse process stdout as UTF-8" )
8782 }
8883
8984 pub fn stderr ( & self ) -> String {
90- String :: from_utf8 ( self . stderr . clone ( ) ) . expect ( "Cannot parse process stderr as UTF-8" )
85+ String :: from_utf8 ( self . 0 . stderr . clone ( ) ) . expect ( "Cannot parse process stderr as UTF-8" )
86+ }
87+ }
88+
89+ impl Default for CommandOutput {
90+ fn default ( ) -> Self {
91+ Self ( Output { status : Default :: default ( ) , stdout : vec ! [ ] , stderr : vec ! [ ] } )
9192 }
9293}
9394
9495impl From < Output > for CommandOutput {
9596 fn from ( output : Output ) -> Self {
96- Self { status : output. status , stdout : output . stdout , stderr : output . stderr }
97+ Self ( output)
9798 }
9899}
99100
100101impl From < ExitStatus > for CommandOutput {
101102 fn from ( status : ExitStatus ) -> Self {
102- Self { status, stdout : Default :: default ( ) , stderr : Default :: default ( ) }
103+ Self ( Output { status, stdout : vec ! [ ] , stderr : vec ! [ ] } )
103104 }
104105}
0 commit comments