File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
crates/crates_io_og_image/src Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -239,19 +239,20 @@ impl OgImageGenerator {
239
239
let json_avatar_map = json_avatar_map. map_err ( OgImageError :: JsonSerializationError ) ?;
240
240
241
241
// Run typst compile command with input data
242
- let output = Command :: new ( & self . typst_binary_path )
243
- . arg ( "compile" )
244
- . arg ( "--format" )
245
- . arg ( "png" )
246
- . arg ( "--input" )
247
- . arg ( format ! ( "data={json_data}" ) )
248
- . arg ( "--input" )
249
- . arg ( format ! ( "avatar_map={json_avatar_map}" ) )
250
- . arg ( & typ_file_path)
251
- . arg ( output_file. path ( ) )
252
- . output ( )
253
- . await
254
- . map_err ( OgImageError :: TypstNotFound ) ?;
242
+ let mut command = Command :: new ( & self . typst_binary_path ) ;
243
+ command. arg ( "compile" ) . arg ( "--format" ) . arg ( "png" ) ;
244
+
245
+ // Pass in the data and avatar map as JSON inputs
246
+ let input = format ! ( "data={json_data}" ) ;
247
+ command. arg ( "--input" ) . arg ( input) ;
248
+ let input = format ! ( "avatar_map={json_avatar_map}" ) ;
249
+ command. arg ( "--input" ) . arg ( input) ;
250
+
251
+ // Pass input and output file paths
252
+ command. arg ( & typ_file_path) . arg ( output_file. path ( ) ) ;
253
+
254
+ let output = command. output ( ) . await ;
255
+ let output = output. map_err ( OgImageError :: TypstNotFound ) ?;
255
256
256
257
if !output. status . success ( ) {
257
258
let stderr = String :: from_utf8_lossy ( & output. stderr ) . to_string ( ) ;
You can’t perform that action at this time.
0 commit comments