Skip to content

Commit 7156464

Browse files
committed
wait after send
Signed-off-by: Petre Eftime <petre.eftime@gmail.com>
1 parent 2e292c1 commit 7156464

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/session.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ impl<W: Write> StreamSession<W> {
2929
/// this is guaranteed to be flushed to the process
3030
/// returns number of written bytes
3131
pub fn send_line(&mut self, line: &str) -> Result<usize, Error> {
32-
let mut len = self.send(line)?;
32+
let mut len = self.send_internal(line)?;
3333
len += self.writer.write(&[b'\n'])?;
34+
std::thread::sleep(std::time::Duration::from_millis(10));
3435
Ok(len)
3536
}
3637

@@ -39,6 +40,12 @@ impl<W: Write> StreamSession<W> {
3940
///
4041
/// Returns number of written bytes
4142
pub fn send(&mut self, s: &str) -> Result<usize, Error> {
43+
let len = self.send_internal(s)?;
44+
std::thread::sleep(std::time::Duration::from_millis(10));
45+
Ok(len)
46+
}
47+
48+
fn send_internal(&mut self, s: &str) -> Result<usize, Error> {
4249
self.writer.write(s.as_bytes()).map_err(Error::from)
4350
}
4451

0 commit comments

Comments
 (0)