BUGFIX: Allocate tmp once

This commit is contained in:
yo 2024-03-31 16:52:10 +02:00
parent 0237f30135
commit c807d95b21

View File

@ -46,9 +46,9 @@ func cmdStdin(commandline []string, input <-chan string) {
// stdout displaying thread // stdout displaying thread
go func() { go func() {
// FIXME
tmp := make([]byte, 1024)
for { for {
// FIXME
tmp := make([]byte, 1024)
_, err := stdout.Read(tmp) _, err := stdout.Read(tmp)
if len(bytes.Trim(tmp, "\x00")) > 0 { if len(bytes.Trim(tmp, "\x00")) > 0 {
for _, line := range strings.Split(strings.ReplaceAll(string(bytes.Trim(tmp, "\x00")), "\r\n", "\n"), "\n") { for _, line := range strings.Split(strings.ReplaceAll(string(bytes.Trim(tmp, "\x00")), "\r\n", "\n"), "\n") {