You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the sidecar to execute long running sub commands, I try to receive new stdout events.
For that I wrote this code:
let(mut rx,mut child) = cmd.spawn().expect("Failed to spawn sidecar");
tauri::async_runtime::spawn(asyncmove{// read events such as stdoutwhileletSome(event) = rx.recv().await{ifletCommandEvent::Stdout(line) = event {debug!("{}", line);
window.emit("upload-progress",Payload{message: line,});}}debug!("upload complete");
window.emit("upload-complete",{});});
But the future of rx.recv() is never resolved when spawning a command that clears its output before writing to it again (i.e. human readable progress in a terminal). It only resolves after the child process exited and then it dumps out all the lines at once.
Using a command that doesn't clear out before updating works fine and it seems like, that it also works fine when the command clears out and writes multiple lines.
I encountered that using the rclone sync source:path target:path --progress --progress-terminal-title --stats-one-line command.
Reproduction
Create an app
Using sidecar, spawn a long running command that always clears stdout before writing to it
Try to receive events from command
rx.recv().await doesn't resolve
Wait until command finsihed
rx.recv().await resolved with the complete output
Expected behavior
rx.recv().await should resolve for every event during running command
Seems like the issue happens because we're setting both stderr and stdout to the os_pipe::pipe() return value (removing the command.stderr(stderr_writer) one fixes it). I'll see if there's a way around it.
Describe the bug
When using the sidecar to execute long running sub commands, I try to receive new stdout events.
For that I wrote this code:
But the future of
rx.recv()
is never resolved when spawning a command that clears its output before writing to it again (i.e. human readable progress in a terminal). It only resolves after the child process exited and then it dumps out all the lines at once.Using a command that doesn't clear out before updating works fine and it seems like, that it also works fine when the command clears out and writes multiple lines.
I encountered that using the
rclone sync source:path target:path --progress --progress-terminal-title --stats-one-line
command.Reproduction
rx.recv().await
doesn't resolverx.recv().await
resolved with the complete outputExpected behavior
rx.recv().await
should resolve for every event during running commandPlatform and versions
Stack trace
No response
Additional context
Discussion with @FabianLars about that here in discord: https://discord.com/channels/616186924390023171/731495047962558564/944267064175132732
The text was updated successfully, but these errors were encountered: