1 个不稳定版本
0.0.1 | 2022年12月23日 |
---|
#8 在 #where
6KB
whereismybin
定位在 PATH 环境变量指定的目录中安装的可执行文件。
此实现的目标是
- 除了标准库外无任何依赖。
- 没有不安全代码,没有系统调用,没有调用 libc。
- 兼容 Miri。
示例
whereismybin 可以作为一个库使用。示例
use std::process::Command;
use whereismybin::whereismybin;
let my_tool = whereismybin("my-tool").expect("Could not find my-tool");
let output = Command::new(my_tool)
.arg("--some-arg")
.output()
.expect("Failed to execute process");
let content = output.stdout;
为什么不使用 which-rs?
which-rs crate 非常好,但不幸的是它不能在 Miri 上运行,并且依赖于 libc crate。 whereismybin 旨在提供更轻量级的替代方案。
许可协议:Apache-2.0
lib.rs
:
定位在 PATH 环境变量指定的目录中安装的可执行文件。
此实现的目标是
- 除了标准库外无任何依赖。
- 没有不安全代码,没有系统调用,没有调用 libc。
- 兼容 Miri。
示例
whereismybin 可以作为一个库使用。示例
use std::process::Command;
use whereismybin::whereismybin;
let my_tool = whereismybin("my-tool").expect("Could not find my-tool");
let output = Command::new(my_tool)
.arg("--some-arg")
.output()
.expect("Failed to execute process");
let content = output.stdout;
为什么不使用 which-rs?
which-rs crate 非常好,但不幸的是它不能在 Miri 上运行,并且依赖于 libc crate。 whereismybin 旨在提供更轻量级的替代方案。