only print stdout on err

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2022-10-25 09:24:05 +02:00
parent 54e3a0d372
commit fe4e05b0bc
No known key found for this signature in database

View file

@ -121,6 +121,10 @@ func (t *TailscaleInContainer) Execute(
if err != nil {
log.Printf("command stderr: %s\n", stderr)
if stdout != "" {
log.Printf("command stdout: %s\n", stdout)
}
if strings.Contains(stderr, "NeedsLogin") {
return "", errTailscaleNotLoggedIn
}
@ -128,10 +132,6 @@ func (t *TailscaleInContainer) Execute(
return "", err
}
if stdout != "" {
log.Printf("command stdout: %s\n", stdout)
}
return stdout, nil
}