mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-22 03:22:30 +00:00
Merge branch 'main' of github.com:roc-lang/roc into simplify_examples
This commit is contained in:
commit
c6ec3d5d30
65 changed files with 3191 additions and 679 deletions
|
@ -22,7 +22,7 @@ pub struct Out {
|
|||
pub status: ExitStatus,
|
||||
}
|
||||
|
||||
pub fn run_roc<I, S>(args: I, stdin_vals: &[&str]) -> Out
|
||||
pub fn run_roc<I, S>(args: I, stdin_vals: &[&str], extra_env: &[(&str, &str)]) -> Out
|
||||
where
|
||||
I: IntoIterator<Item = S>,
|
||||
S: AsRef<OsStr>,
|
||||
|
@ -62,7 +62,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
run_with_stdin(&roc_binary_path, args, stdin_vals)
|
||||
run_with_stdin_and_env(&roc_binary_path, args, stdin_vals, extra_env)
|
||||
}
|
||||
|
||||
pub fn run_glue<I, S>(args: I) -> Out
|
||||
|
@ -118,6 +118,19 @@ pub fn strip_colors(str: &str) -> String {
|
|||
}
|
||||
|
||||
pub fn run_with_stdin<I, S>(path: &Path, args: I, stdin_vals: &[&str]) -> Out
|
||||
where
|
||||
I: IntoIterator<Item = S>,
|
||||
S: AsRef<OsStr>,
|
||||
{
|
||||
run_with_stdin_and_env(path, args, stdin_vals, &[])
|
||||
}
|
||||
|
||||
pub fn run_with_stdin_and_env<I, S>(
|
||||
path: &Path,
|
||||
args: I,
|
||||
stdin_vals: &[&str],
|
||||
extra_env: &[(&str, &str)],
|
||||
) -> Out
|
||||
where
|
||||
I: IntoIterator<Item = S>,
|
||||
S: AsRef<OsStr>,
|
||||
|
@ -128,6 +141,10 @@ where
|
|||
cmd.arg(arg);
|
||||
}
|
||||
|
||||
for (k, v) in extra_env {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
|
||||
let mut child = cmd
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue