make logforward exit on error, saving buffer first

This commit is contained in:
Andreas Neue 2018-07-02 10:41:33 +02:00
parent 7909a17fbf
commit 33aefc1d25
1 changed files with 4 additions and 2 deletions

View File

@ -15,7 +15,6 @@ import (
"os"
"time"
"git.dnix.de/an/xlog"
goscp "github.com/bramvdbogaerde/go-scp"
"github.com/bramvdbogaerde/go-scp/auth"
"golang.org/x/crypto/ssh"
@ -40,7 +39,10 @@ func main() {
time.Sleep(1 * time.Microsecond)
line, err := reader.ReadString('\n')
if err != nil {
xlog.Error(err.Error())
fmt.Printf("%s\n", err.Error())
l := []byte(log)
gzipAndSend(l)
return
} else {
log += line
fmt.Printf("%d\r", len(log))