summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go')
-rw-r--r--vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go b/vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go
index 0f9d9524..71ec37d3 100644
--- a/vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go
+++ b/vendor/github.com/keybase/go-keybase-chat-bot/kbchat/team.go
@@ -1,8 +1,10 @@
package kbchat
import (
+ "bytes"
"encoding/json"
"fmt"
+ "log"
"strings"
"github.com/keybase/go-keybase-chat-bot/kbchat/types/keybase1"
@@ -27,13 +29,18 @@ func (a *API) ListMembersOfTeam(teamName string) (res keybase1.TeamMembersDetail
apiInput := fmt.Sprintf(`{"method": "list-team-memberships", "params": {"options": {"team": "%s"}}}`, teamName)
cmd := a.runOpts.Command("team", "api")
cmd.Stdin = strings.NewReader(apiInput)
- bytes, err := cmd.CombinedOutput()
+ var stderr bytes.Buffer
+ cmd.Stderr = &stderr
+ output, err := cmd.Output()
if err != nil {
return res, APIError{err}
}
+ if stderr.Len() != 0 {
+ log.Printf("ListMembersOfTeam error: %s", stderr.String())
+ }
members := ListTeamMembers{}
- err = json.Unmarshal(bytes, &members)
+ err = json.Unmarshal(output, &members)
if err != nil {
return res, UnmarshalError{err}
}
@@ -47,13 +54,18 @@ func (a *API) ListUserMemberships(username string) ([]keybase1.AnnotatedMemberIn
apiInput := fmt.Sprintf(`{"method": "list-user-memberships", "params": {"options": {"username": "%s"}}}`, username)
cmd := a.runOpts.Command("team", "api")
cmd.Stdin = strings.NewReader(apiInput)
- bytes, err := cmd.CombinedOutput()
+ var stderr bytes.Buffer
+ cmd.Stderr = &stderr
+ output, err := cmd.Output()
if err != nil {
return nil, APIError{err}
}
+ if stderr.Len() != 0 {
+ log.Printf("ListUserMemberships error: %s", stderr.String())
+ }
members := ListUserMemberships{}
- err = json.Unmarshal(bytes, &members)
+ err = json.Unmarshal(output, &members)
if err != nil {
return nil, UnmarshalError{err}
}