From f8143772762838e5bff67d877e29764b02189ed7 Mon Sep 17 00:00:00 2001 From: Shinyzenith Date: Sat, 30 Jul 2022 17:05:14 +0530 Subject: [PATCH] [BuildSystem]Don't depend on system shell for scd Signed-off-by: Shinyzenith --- Makefile | 1 + build.rs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 260eeeff..0290ceae 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ check: clean: @cargo clean + @rm -f ./docs/*.1.gz setup: @rustup install stable diff --git a/build.rs b/build.rs index b58765b0..3925a55d 100644 --- a/build.rs +++ b/build.rs @@ -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 @@ -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(); } }