feat(root): threat-safe terminal writer
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
package root
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var termMutex sync.Mutex
|
||||||
|
|
||||||
|
func TermWrite(data []byte) {
|
||||||
|
termMutex.Lock()
|
||||||
|
defer termMutex.Unlock()
|
||||||
|
os.Stdout.Write(data)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user