Skip to content

executable doesn't ever close. #29679

Closed
Closed
@pmwhite

Description

@pmwhite
use std::collections::BTreeMap;

enum Object {
    Str(String),
    Int(i32),
    Float(f32),
    Vector(Vec<Object>),
    //Prim(fn(State) -> State)
}

//struct State<'a> {
    //named: &'a mut BTreeMap<String, Object<'a>>,
    //stack: Vec<Object<'a>>
//}

fn printObj(obj: &Object) {
    println!("starting object...");
    match obj {
        &Object::Str(ref s) => println!("string: {}", s),
        &Object::Int(ref i) => println!("int: {}", i),
        &Object::Float(ref f) => println!("float: {}", f),
        &Object::Vector(ref v) => {
            println!("Vector: ");
            for item in v {
                printObj(item);
            }
        },
        //Object::Prim(f) => println!("primitive function")
    }
    println!("ending object...");
}
//fn print(state: &State<'a>) {
    //for (key, value) in state.named.iter() {
        //println!("{}", key);
        //printObj(value);
        //println!("");
    //}
//}

fn main() {
    println!("Hello, world!");
    let obj = Object::Str("this is a test".to_string());
    printObj(&obj);
}

I wrote the code above to get more familiar with rust. This is the exact code; I didn't even take out the commented parts.

I ran cargo build, which gave me a snake case warning and a few unused code warnings. I was so pleased at actually succeeding in building it that I didn't care about the warnings.

I next ran cargo run. Confusingly, it hung. I ctrl-c'd the process and continued on my way. I then tried again. Same thing happened. I decided to rebuild, so I changed the file by adding a blank line; I then cargo build'd again, and I got back Unknown error and something to the effect of use the verbose flag to find out more.
When I used the verbose flag, I got Access is denied (OS error 5)
After a bit of searching, I discovered in the task manager that the process was still running. Logically, I attempted to kill the process; I got back a dialog box saying Access is denied.

I tried signing out and signing back in, to no avail. I was googling around and it seemed that the only solution was to shut down and restart my computer. This succeeded.
My googling leads me to believe that I was unable to close the process because it was in kernel mode or something driver related.
I found this: http://superuser.com/questions/585073/how-to-overcome-access-denied-when-killing-process-in-windows; it seems to be related, but it didn't fix anything.

After I restarted, I ran the program again. It hung again, but this time I closed the cmd prompt instead of ctrl-c'ing the process. The process did not hang around forever this time.

I'm not really sure if this is an issue with rust, and perhaps I should have just SO'ed the code and come here second, but here it is.

I'm using windows 10 and Rust 1.3; anything else you need to know, just ask.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions