CharlyCst / miralis

Miralis is an experimental system that virtualises firmware
https://miralis-firmware.github.io/
MIT License
7 stars 0 forks source link

Firmware build does not check its' existence correctly? #196

Open Wesdcv opened 1 day ago

Wesdcv commented 1 day ago

https://github.com/CharlyCst/miralis/blob/0e5cc95210c3f6390c77168058f3e4ef4dfdf125/runner/src/build.rs#L10-L19

I believe in case if path to the firmware is invalid, we should get a panic!(). But in practice we get:

just build-firmware nonexistent
cargo run -- build -v --config config.toml --firmware nonexistent
    Finished dev [optimized + debuginfo] target(s) in 0.16s
     Running `target/debug/runner build -v --config config.toml --firmware nonexistent`
Built firmware, binary available at:
nonexistent

Not quite sure if that's an expected behaviour, probably a bug?

CharlyCst commented 10 hours ago

Hmmm no that's not the expected behavior, I agree that exiting with an error would be the right solution.

It should not be a panic though. Panics are for bugs (they print info about the source code), here we want to return an error to the user and the way to do that is to print a message explaining the issue and exiting with a non-zero error code (we use 1). You can do this with std::process::exit.