Fabian v.d.W
Fabian v.d.W

Reputation: 175

Permission denied Error when trying to start another executable from Rust

I am trying to start a subprocess in Rust. It is another executable.

Minimal Code looks like this:

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!");
}

I get the following error:

thread 'main' panicked at 'Failed to execute command!: Os { code: 5, kind: Permi
ssionDenied, message: "Zugriff verweigert" }', src\libcore\result.rs:997:5

Upvotes: 2

Views: 1389

Answers (1)

Fabian v.d.W
Fabian v.d.W

Reputation: 175

When removing the escaped quotes( which I set as they are needed to start the process in cmd.exe) it works.

Upvotes: 1

Related Questions