Replies: 1 comment 1 reply
-
Never mind... this is not Relm4 specific. Just used
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have a child process which generates some output. I want to display that output in a GTK TexView.
I used the Command API to do this, so like:
where
spawn_child()
is an async fn which spawns the child process and returnsstd::process::Child
Then I use Relm4's update_cmd() API to catch and process the command output like:
This kinda works, but the view gets updated only after the process is finished so it's like buffering the output. I want to read lines from stdout and stderr as they are getting generated and display those lines in the corresponding text view widgets in real-time.
This works fine if I just
println!()
the line, but doesn't work with the widget.I'm new to multi threading and I'm sure this is related to threads. But my understanding is that the async function and the oneshot_command are supposed to run that child process code in the background asynchronously, so the main thread shouldn't be blocked. Obviously I'm missing something here.
How do I do this properly? Any help would be highly appreciated. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions