Skip to content

Commit

Permalink
[BuildSystem]Don't depend on system shell for scd
Browse files Browse the repository at this point in the history
Signed-off-by: Shinyzenith <[email protected]>
  • Loading branch information
Shinyzenith committed Jul 30, 2022
1 parent e8d9878 commit f814377
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ check:

clean:
@cargo clean
@rm -f ./docs/*.1.gz

setup:
@rustup install stable
Expand Down
19 changes: 15 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
use std::{fs::read_dir, io::ErrorKind, process::exit, process::Command};
use std::{
fs::{read_dir, File, OpenOptions},
io::ErrorKind,
path::Path,
process::exit,
process::{Command, Stdio},
};

fn main() {
// Check if scdoc command exists
Expand All @@ -25,9 +31,14 @@ fn main() {
}

for man_page in man_pages {
_ = Command::new("sh")
.arg("-c")
.arg(format!("scdoc <{}>{}", man_page.0, man_page.1))
let output = OpenOptions::new()
.write(true)
.create(true)
.open(Path::new(&man_page.1))
.unwrap();
_ = Command::new("scdoc")
.stdin(Stdio::from(File::open(man_page.0).unwrap()))
.stdout(output)
.spawn();
}
}

0 comments on commit f814377

Please sign in to comment.