【发布时间】:2016-05-28 12:15:11
【问题描述】:
在 Python 中我可以:
from distutils import spawn
cmd = spawn.find_executable("commandname")
我尝试了类似下面的代码,但它假定您在类似 unix 的系统上,/usr/bin/which 可用(还涉及执行我想避免的外部命令):
use std::process::Command;
let output = Command::new("which")
.arg("commandname")
.unwrap_or_else(|e| /* handle error here */)
在 Rust 中最简单的方法是什么?
【问题讨论】:
标签: rust