File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ impl Renderer for CmdRenderer {
151
151
}
152
152
153
153
fn render ( & self , ctx : & RenderContext ) -> Result < ( ) > {
154
- info ! ( "Invoking the \" {}\" renderer" , self . cmd ) ;
154
+ info ! ( "Invoking the \" {}\" renderer" , self . name ) ;
155
155
156
156
let _ = fs:: create_dir_all ( & ctx. destination ) ;
157
157
@@ -183,7 +183,7 @@ impl Renderer for CmdRenderer {
183
183
184
184
if !status. success ( ) {
185
185
error ! ( "Renderer exited with non-zero return code." ) ;
186
- bail ! ( "The \" {}\" renderer failed" , self . cmd ) ;
186
+ bail ! ( "The \" {}\" renderer failed" , self . name ) ;
187
187
} else {
188
188
Ok ( ( ) )
189
189
}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ extern crate mdbook;
4
4
extern crate tempdir;
5
5
6
6
use std:: fs:: File ;
7
+ use std:: path:: Path ;
7
8
use tempdir:: TempDir ;
8
9
use mdbook:: config:: Config ;
9
10
use mdbook:: MDBook ;
@@ -30,11 +31,23 @@ fn alternate_backend_with_arguments() {
30
31
md. build ( ) . unwrap ( ) ;
31
32
}
32
33
34
+ /// Get a command which will pipe `stdin` to the provided file.
35
+ fn tee_command < P : AsRef < Path > > ( out_file : P ) -> String {
36
+ let out_file = out_file. as_ref ( ) ;
37
+
38
+ if cfg ! ( windows) {
39
+ format ! ( "cmd.exe /c \" type > {}\" " , out_file. display( ) )
40
+ } else {
41
+ format ! ( "tee {}" , out_file. display( ) )
42
+ }
43
+ }
44
+
33
45
#[ test]
46
+ #[ cfg( not( windows) ) ]
34
47
fn backends_receive_render_context_via_stdin ( ) {
35
48
let temp = TempDir :: new ( "output" ) . unwrap ( ) ;
36
49
let out_file = temp. path ( ) . join ( "out.txt" ) ;
37
- let cmd = format ! ( "tee {}" , out_file. display ( ) ) ;
50
+ let cmd = tee_command ( & out_file) ;
38
51
39
52
let ( md, _temp) = dummy_book_with_backend ( "cat-to-file" , & cmd) ;
40
53
You can’t perform that action at this time.
0 commit comments