remote: Flush to stdin when writing to sftp (#42103) (cherry-pick to preview) (#42361)

zed-zippy[bot] and Lukas Wirth created

Cherry-pick of #42103 to preview

----

https://github.com/zed-industries/zed/issues/42027#issuecomment-3497210172

Release Notes:

- Fixed ssh remoting potentially failing due to not flushing stdin to
sftp

Co-authored-by: Lukas Wirth <lukas@zed.dev>

Change summary

crates/remote/src/transport/ssh.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/remote/src/transport/ssh.rs 🔗

@@ -850,7 +850,7 @@ impl SshRemoteConnection {
             if let Some(mut stdin) = child.stdin.take() {
                 use futures::AsyncWriteExt;
                 stdin.write_all(sftp_batch.as_bytes()).await?;
-                drop(stdin);
+                stdin.flush().await?;
             }
 
             let output = child.output().await?;