@@ -77,7 +77,7 @@ pub struct Kaleido {
77
77
impl Kaleido {
78
78
pub fn new ( ) -> Kaleido {
79
79
let path = match Kaleido :: binary_path ( ) {
80
- Ok ( path) => std :: fs :: canonicalize ( path) . unwrap ( ) ,
80
+ Ok ( path) => path,
81
81
Err ( msg) => panic ! ( msg) ,
82
82
} ;
83
83
@@ -107,7 +107,7 @@ impl Kaleido {
107
107
}
108
108
109
109
#[ cfg( target_os = "macos" ) ]
110
- fn kaleido_binary_path ( ) -> Result < PathBuf , & ' static str > {
110
+ fn binary_path ( ) -> Result < PathBuf , & ' static str > {
111
111
let mut p = Kaleido :: root_dir ( ) ?;
112
112
p = p
113
113
. join ( "kaleido" )
@@ -122,14 +122,9 @@ impl Kaleido {
122
122
}
123
123
124
124
#[ cfg( target_os = "windows" ) ]
125
- fn kaleido_binary_path ( ) -> Result < PathBuf , & ' static str > {
125
+ fn binary_path ( ) -> Result < PathBuf , & ' static str > {
126
126
let mut p = Kaleido :: root_dir ( ) ?;
127
- p = p
128
- . join ( "kaleido" )
129
- . join ( "windows" )
130
- . join ( "kaleido.cmd" )
131
- . canonicalize ( )
132
- . unwrap ( ) ;
127
+ p = p. join ( "kaleido" ) . join ( "windows" ) . join ( "kaleido.cmd" ) ;
133
128
if !p. exists ( ) {
134
129
return Err ( "could not find kaleido executable in path" ) ;
135
130
}
@@ -157,7 +152,7 @@ impl Kaleido {
157
152
. args ( & [ "plotly" , "--disable-gpu" ] )
158
153
. stdin ( Stdio :: piped ( ) )
159
154
. stdout ( Stdio :: piped ( ) )
160
- . stderr ( Stdio :: null ( ) )
155
+ . stderr ( Stdio :: piped ( ) )
161
156
. spawn ( )
162
157
. expect ( "failed to spawn Kaleido binary" ) ;
163
158
@@ -177,7 +172,7 @@ impl Kaleido {
177
172
let res = KaleidoResult :: from ( l. as_str ( ) ) ;
178
173
if let Some ( image_data) = res. result {
179
174
let data: Vec < u8 > = match image_format {
180
- "svg" => image_data. as_bytes ( ) . to_vec ( ) ,
175
+ "svg" | "eps" => image_data. as_bytes ( ) . to_vec ( ) ,
181
176
_ => base64:: decode ( image_data) . unwrap ( ) ,
182
177
} ;
183
178
let mut file = File :: create ( dst. as_path ( ) ) ?;
@@ -187,6 +182,9 @@ impl Kaleido {
187
182
}
188
183
}
189
184
185
+ let mut errors = String :: new ( ) ;
186
+ process. stderr . unwrap ( ) . read_to_string ( & mut errors) ;
187
+ println ! ( "errors {}" , errors) ;
190
188
Ok ( ( ) )
191
189
}
192
190
}
0 commit comments