Execute a program
This commit is contained in:
parent
4343d59a9a
commit
9020370f74
30
src/main.rs
30
src/main.rs
@ -1,21 +1,21 @@
|
|||||||
// Usage: your_docker.sh run <image> <command> <arg1> <arg2> ...
|
// Usage: your_docker.sh run <image> <command> <arg1> <arg2> ...
|
||||||
fn main() {
|
fn main() {
|
||||||
// You can use print statements as follows for debugging, they'll be visible when running tests.
|
// You can use print statements as follows for debugging, they'll be visible when running tests.
|
||||||
println!("Logs from your program will appear here!");
|
// println!("Logs from your program will appear here!");
|
||||||
|
|
||||||
// Uncomment this block to pass the first stage!
|
// Uncomment this block to pass the first stage!
|
||||||
// let args: Vec<_> = std::env::args().collect();
|
let args: Vec<_> = std::env::args().collect();
|
||||||
// let command = &args[3];
|
let command = &args[3];
|
||||||
// let command_args = &args[4..];
|
let command_args = &args[4..];
|
||||||
// let output = std::process::Command::new(command)
|
let output = std::process::Command::new(command)
|
||||||
// .args(command_args)
|
.args(command_args)
|
||||||
// .output()
|
.output()
|
||||||
// .unwrap();
|
.unwrap();
|
||||||
//
|
|
||||||
// if output.status.success() {
|
if output.status.success() {
|
||||||
// let std_out = std::str::from_utf8(&output.stdout).unwrap();
|
let std_out = std::str::from_utf8(&output.stdout).unwrap();
|
||||||
// println!("{}", std_out)
|
println!("{}", std_out)
|
||||||
// } else {
|
} else {
|
||||||
// std::process::exit(1);
|
std::process::exit(1);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user