-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basics for
test
command in build system
- Loading branch information
1 parent
0348a5f
commit fcd336b
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::utils::run_command_with_output; | ||
|
||
fn get_args<'a>(args: &mut Vec<&'a dyn AsRef<std::ffi::OsStr>>, extra_args: &'a Vec<String>) { | ||
for extra_arg in extra_args { | ||
args.push(extra_arg); | ||
} | ||
} | ||
|
||
pub fn run() -> Result<(), String> { | ||
let mut args: Vec<&dyn AsRef<std::ffi::OsStr>> = vec![&"bash", &"test.sh"]; | ||
let extra_args = std::env::args().skip(2).collect::<Vec<_>>(); | ||
get_args(&mut args, &extra_args); | ||
let current_dir = std::env::current_dir().map_err(|error| format!("`current_dir` failed: {:?}", error))?; | ||
run_command_with_output(args.as_slice(), Some(¤t_dir)) | ||
} |