|
|
|
@ -155,9 +155,10 @@ func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) {
@@ -155,9 +155,10 @@ func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) {
|
|
|
|
|
} |
|
|
|
|
keybaseListen := exec.Command(k.Path, execCommand...) |
|
|
|
|
keybaseOutput, _ := keybaseListen.StdoutPipe() |
|
|
|
|
|
|
|
|
|
for { |
|
|
|
|
keybaseListen.Start() |
|
|
|
|
scanner := bufio.NewScanner(keybaseOutput) |
|
|
|
|
|
|
|
|
|
go func(scanner *bufio.Scanner, c chan<- ChatIn) { |
|
|
|
|
var jsonData ChatIn |
|
|
|
|
for scanner.Scan() { |
|
|
|
@ -167,6 +168,7 @@ func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) {
@@ -167,6 +168,7 @@ func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) {
|
|
|
|
|
}(scanner, c) |
|
|
|
|
keybaseListen.Wait() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Run() runs keybase chat api-listen, and passes incoming messages to the message handler func
|
|
|
|
|
func (k Keybase) Run(handler func(ChatIn), options ...RunOptions) { |
|
|
|
|