Command

Command (프로세스 빌더 구조체)

새 프로세스를 어떻게 스폰할지 세밀하게 제어할 수 있는 프로세스 빌더예요.

출처: Rust 공식 문서

본문

기본 구성은 Command::new(program)을 사용해 생성할 수 있는데, 여기서 program은 실행할 프로그램의 경로를 나타내요. 그 후 arg, env, current_dir 같은 빌더 메서드로 구성을 조정할 수 있어요.

pub struct Command { /* private fields */ }

예시

use std::process::Command;

let output = Command::new("echo").arg("hello").output();

더 알아보기 (Learn more)

Rust 공식 문서