13个版本
| 0.4.0 | 2023年7月31日 |
|---|---|
| 0.3.4 | 2023年6月7日 |
| 0.3.3 | 2022年11月25日 |
| 0.3.2 | 2022年6月13日 |
| 0.1.4 | 2021年10月20日 |
#464 in Unix API
23KB
429 行
transparent
在虚拟桌面/虚拟X服务器环境中运行进程的crate。
用法
这将在一个新的虚拟桌面/虚拟X服务器环境中启动 some program。
Command::new("some program")
.spawn_transparent(&TransparentRunner::new())
.unwrap()
.wait()
.unwrap();
工作原理
Windows
在Windows上,transparent 使用 CreateDesktopW 创建一个新的桌面,然后使用 CreateProcessW 创建一个子进程,并将 lpStartupInfo.lpDesktop 设置为新桌面。实际上,它首先启动一个辅助进程,然后该进程再启动目标进程;请参阅 virtual-desktop-runner。
Unix
在Unix上,transparent 使用 xvfb-run 在虚拟X服务器环境中运行目标应用程序。
已知问题
目前,不使用 mem::transmute 或类似方法,无法确定 Stdio 的指定 Command,这就是为什么 transparent 总是使用 Stdio::piped() 的原因。
许可证
MIT许可证下授权 (LICENSE 或 https://open-source.org.cn/licenses/MIT)
依赖关系
~1.1–9.5MB
~106K SLoC