权限被拒绝尝试从Rust启动另一个可执行文件时出错

问题描述 投票:-1回答:1

我正在尝试在Rust中启动子进程。这是另一个可执行文件

最小代码如下所示:

use std::process::{Command, Stdio};

fn main() {
    let mut child = Command::new("\"./target/release/path_to_binary.exe\"")
        .stdin(Stdio::piped())
        .stdout(Stdio::piped())
        .output()
        .expect("Failed to execute command!");
}

我收到以下错误:

thread 'main' panicked at 'Failed to execute command!: Os { code: 5, kind: Permi
ssionDenied, message: "Zugriff verweigert" }', src\libcore\result.rs:997:5
process rust
1个回答
0
投票

当删除转义的引号(我设置为在cmd.exe中启动进程所需的引号)时,它可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.