Suddenly unable to run exe

Hi, i have a small http server project and i am aligning to a rust udemy course. Suddenly, after adding some debug annotations, i am not able to run my project anymore.

I am on windows. cargo run works an creates all necessary files in target/debug
When i try cargo run i get the following error:

$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target\debug\server.exe`
error: could not execute process `target\debug\server.exe` (never executed)

Caused by:
  Zugriff verweigert (os error 5)

What happens? the 'server.exe' is deleted when i try to run with cargo. It gets even deleted, when i double-click on the server.exe. My antivirus program is not mentioning anything.

It is this code, where i do changes. This is the way it runs and i have no problems:

match Request::try_from(&buffer[..]) {
                                Ok(request) => {
                                    dbg!();
                                }
                                Err(e) => println!("Failed to parse a request: {}", e)
                            }

And when adding the request-variable inside the dbg!-macro, it can't run the programm anymore but instead the server.exe gets deleted:

match Request::try_from(&buffer[..]) {
                                Ok(request) => {
                                    dbg!(request);
                                }
                                Err(e) => println!("Failed to parse a request: {}", e)
                            }

The request is this struct:

#[derive(Debug)]
pub struct Request<'buf> {
    path: &'buf str,
    query_string: Option<QueryString<'buf>>,
    method: Method,
}

Does anyone know, why this problem occurs?

This is almost certainly your antivirus.

4 Likes

I tried the code on an Ubuntu virtual machine and it works perfectly. It really looks like an antivirus problem...

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.