Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellga committed May 2, 2024
1 parent 7abe466 commit 26056df
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
on:
push:
branches: [ main, master ]
paths:
- rdocs/**
workflow_run:
workflows: ["R-CMD-check"]
types:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rdocs"
version = "0.1.34"
version = "0.1.35"
edition = "2021"
repository = "https://github.com/daniellga/rdocs/"

Expand Down
2 changes: 1 addition & 1 deletion rdocs/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rdocs
Title: Create Quarto documentation for R files from comments
Version: 0.1.34
Version: 0.1.35
Authors@R:
person("Daniel", "Gurgel", , "[email protected]", role = c("aut", "cre"))
Description: Generate R documentation in Quarto format based on comments in code files.
Expand Down
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
fs::File,
io::{BufRead, BufReader, Write},
path::{Component, Path, PathBuf},
process::Command,
process::{Command, Stdio},
};

/// Create quarto docs from code comments. The command must be called in the package's main folder.
Expand Down Expand Up @@ -209,10 +209,17 @@ fn eval_examples(examples: Vec<String>) {
let pkg_call = ["library", pkg_name].join(" ");
let output_text = [pkg_call.as_str(), examples.join(";").as_str()].join(";");

let _ = Command::new("Rscript")
let output = Command::new("Rscript")
.args(["--vanilla", "-e", output_text.as_str()])
.stdout(Stdio::null())
.stderr(Stdio::piped())
.output()
.unwrap_or_else(|_| panic!("Error running example:\n{}", output_text));
.expect("Failed to execute Rscript");

if !output.status.success() {
let error_message = String::from_utf8_lossy(&output.stderr);
panic!("Error running example:\n{}", error_message);
}
}

// Create a quarto project and render.
Expand Down

0 comments on commit 26056df

Please sign in to comment.