Have rebar3.cmd work on a Windows CMD shell (#151)

* Provide a working rebar.cmd for system that need it

(Windows on non-PowerShell)

* Add tests for recent changes

If the "run" were to fail the job would too

* Check if Rust can find it
This commit is contained in:
Paulo F. Oliveira
2022-12-01 19:16:40 +00:00
committed by GitHub
parent b980a5ac9b
commit 35850967ef
7 changed files with 66 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
/target/
main
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "rust_rebar3_cmd"
version = "0.1.0"
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "rust_rebar3_cmd"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+32
View File
@@ -0,0 +1,32 @@
use std::env;
use std::process;
use std::string;
// an example function...
fn main() {
let key = "PATH";
match env::var(key) {
Ok(val) => println!("{key}: {val:?}"),
Err(e) => println!("couldn't interpret {key}: {e}"),
}
}
#[allow(dead_code)]
fn rebar3_cmd_version() -> Result<String, string::FromUtf8Error> {
println!("going for rebar3.cmd");
let output = process::Command::new("rebar3.cmd")
.arg("version")
.output()
.expect("error");
return String::from_utf8(output.stdout);
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
rebar3_cmd_version().unwrap();
}
}