mun-lang / mun

Source code for the Mun language and runtime.
https://mun-lang.org
Other
1.81k stars 72 forks source link

Hot reload not working on Ubuntu WSL #566

Closed trsh closed 1 month ago

trsh commented 1 month ago

Code

use mun_runtime::Runtime;

fn main() {
    let builder = Runtime::builder("/mnt/c/Projects/AAI/rs/xx/hello_fibonacci/target/mod.munlib");
    let mut runtime = unsafe { builder.finish() }.expect("Failed to spawn Runtime");

    loop {
        let arg: i64 = runtime.invoke("arg", ()).unwrap();
        let result: i64 = runtime.invoke("fibonacci", (arg,)).unwrap();
        println!("fibonacci({}) = {}", arg, result);

        unsafe { runtime.update() };
    }
}

When I update mod.munlib via mun build, the rust still prints old values, until I exit and run it again.

trsh commented 1 month ago

Nvm, was issue with the file system, not recognizing changes on mounted paths

Wodann commented 1 month ago

No problem!

Could you please elaborate on the issue with the file system and how you were able to solve it?

It might be helpful for other users that run into the same issue.

trsh commented 1 month ago

No problem!

Could you please elaborate on the issue with the file system and how you were able to solve it?

It might be helpful for other users that run into the same issue.

On Windows Ubuntu WSL, for mounted directories and files, the file changes just aren't registered. So --watch is not working and runtime.update neither (I guess it is also checking if file was 'touched'). So I just moved my project to /home/user/something/something and it works.

Wodann commented 1 month ago

Thank you!