Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing args to cli results in this args being pased to gtk which cusses it to exit with code 0 #1436

Closed
Horryportier opened this issue Jul 26, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Horryportier
Copy link

Bug description
i have cli tool that controls mpv thought socket. I wanted to add simple player window so i added flag for that -g but when running it with that flag using cargo run -- -g or . /target/debug/bin_name -g it will exit with code 1. But when changing it to run without any args it creates window as it should.

fn main() {
    let args = args().collect::<Vec<String>>();
    let args = &args[1..];
    if args[0] == "-g".to_string() {
        println!("{}", gui());
    }
}

pub fn gui() ->  ExitCode {
    let app = Application::builder().application_id(API_ID).build();

    app.run()
} 

Backtrace

bug.txt

@Horryportier Horryportier added the bug Something isn't working label Jul 26, 2023
@bilelmoussaoui
Copy link
Member

If you want to handle the cli yourself without going through glib, you should use run_with_args and pass an empty vec to it iirc

@Horryportier
Copy link
Author

thanks now works without any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants