Replacing requested user input with a variable on a process multiple times

Hello guys! I'm trying to make a CLI wrapper, but i don't know how to replace the requested user input with a variable or something(the command in which I wanted to do that does the following: firstly prints something , then requests for user input, and lastly prints some output again)
The code I've done so far:

let mut child = Command::new("solana-keygen")
        // .current_dir("")


    //  child.wait().expect("Failed to read stdout");

    let mut stdin = child.stdin.take().expect("Failed to open stdin");
            .expect("Failed to write to stdin");

     let  output = child.wait_with_output().expect("Failed to read stdout");
     println!("output = {}", output.stdout_to_string());

Does anyone know how I could solve this?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.