dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Make dioxus-cli "serve" the app by calling Cargo instead of the app itself ?

Open jrouaix opened this issue 2 years ago • 1 comments

From what I see here, the app is called directly

https://github.com/DioxusLabs/dioxus/blob/300cbf4fc671cb9f28e9b2336df12d001a816c8c/packages/cli/src/server/desktop/mod.rs#L231C77-L246C77

IMHO, we could do a better/idiomatic way of calling the app by calling cargo run.

This will allow all the good cargo stuff, for example (this is how I discovered it 30 minutes ago), the cargo config.toml file is not handled and it's really a pain. Think about RUST_LOG configuration for example (https://doc.rust-lang.org/cargo/reference/config.html)

Would you consider this option ? perhaps I can contribute it ?

jrouaix avatar Sep 12 '23 08:09 jrouaix

I aggree, running a desktop binary with cargo run should make things more consistent. I ran into some inconsistencies in https://github.com/DioxusLabs/dioxus/pull/1369 as well. The current working directory of cargo run and running the executable directly were different. That PR just overrides the current working directory, but using cargo run directly will help prevent similar future issues

ealmloff avatar Sep 12 '23 14:09 ealmloff

Chatted with some folks more experienced than me with this stuff and we were told to not make cargo observable / rely on its observability. There are separate questions here about the current_exe and current_dir that we need to resolve with #232

jkelleyrtp avatar Jul 24 '24 23:07 jkelleyrtp