Pipelines, container orchestration, and command-line tools all share a common task: they all have to start and monitor other programs. These system calls are done in a variety of ways in other technologies, so let's call a few standard programs with Rust's Command interface.
Starting subprocesses
How to do it...
Follow these quick steps to call on external programs:
- Open a Terminal to create a new project using cargo new sub-processes. Use VS Code to open the project directory.
- Open src/main.rs. Rust's standard library comes with an external command interface built-in, but first, let's import it:
use std::error::Error;
use std::io::Write;
use std::process::{Command, Stdio};
- Once imported, we can do the...