Introduction
In this lab, we learn about child processes in Rust using the process::Output
struct to represent the output of a finished child process and the process::Command
struct to build processes. The example code demonstrates how to execute the rustc --version
command and handle the output accordingly by checking if the process succeeded or failed.
Note: If the lab does not specify a file name, you can use any file name you want. For example, you can use
main.rs
, compile and run it withrustc main.rs && ./main
.