#Passing command args to tauri

2 messages · Page 1 of 1 (latest)

tiny isle
#

Hi, I'm trying to start a process from a GUI. Creating args on the frontend and passing it to tauri. I get a warning for &[&str], but I'm not sure how to deserialize that, since it's a function parameter. Is there a way I could do that or another type I could use? I think I could break the string apart in rust? Hoping there is something simpler. This is what I have currently:

#[tauri::command] 
async fn start_testnet(
    window: Window, 
    args: &[&str] //Need to deserialize (the trait bound `&[&str]: Deserialize<'_>` is not satisfied)
) {
    let mut child = Command::new("anvil")
                        .args(args)
                        .stdout(Stdio::piped())
                        .spawn()
                        .expect("anvil failed to run");
    ...
}

Thanks for any help.

sonic flower
#

you could use Vec<String> i think