Skip to content

Commit 90bb5b9

Browse files
committed
og_image: Add comments to Command arguments
1 parent f45a7d9 commit 90bb5b9

File tree

1 file changed

+14
-13
lines changed
  • crates/crates_io_og_image/src

1 file changed

+14
-13
lines changed

crates/crates_io_og_image/src/lib.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,20 @@ impl OgImageGenerator {
239239
let json_avatar_map = json_avatar_map.map_err(OgImageError::JsonSerializationError)?;
240240

241241
// 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)?;
255256

256257
if !output.status.success() {
257258
let stderr = String::from_utf8_lossy(&output.stderr).to_string();

0 commit comments

Comments
 (0)