From dfc90de3dc4333ffa1446263f66be8233c08162d Mon Sep 17 00:00:00 2001 From: Robert Meerman Date: Thu, 27 Jun 2024 02:05:12 +0100 Subject: [PATCH] Add Term.Drain() --- term_posix.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/term_posix.go b/term_posix.go index e0d1806..eda89cd 100644 --- a/term_posix.go +++ b/term_posix.go @@ -191,6 +191,11 @@ func (t *Term) Flush() error { return termios.Tcflush(uintptr(t.fd), termios.TCIOFLUSH) } +// Drain waits until all output written to the term has been transmitted. +func (t *Term) Drain() error { + return termios.Tcdrain(uintptr(t.fd)) +} + // SendBreak sends a break signal. func (t *Term) SendBreak() error { return termios.Tcsendbreak(uintptr(t.fd), 0)