|
|
@ -156,14 +156,16 @@ func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) { |
|
|
|
keybaseListen := exec.Command(k.Path, execCommand...) |
|
|
|
keybaseListen := exec.Command(k.Path, execCommand...) |
|
|
|
keybaseOutput, _ := keybaseListen.StdoutPipe() |
|
|
|
keybaseOutput, _ := keybaseListen.StdoutPipe() |
|
|
|
keybaseListen.Start() |
|
|
|
keybaseListen.Start() |
|
|
|
keybaseListen.Wait() |
|
|
|
|
|
|
|
scanner := bufio.NewScanner(keybaseOutput) |
|
|
|
scanner := bufio.NewScanner(keybaseOutput) |
|
|
|
var jsonData ChatIn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for scanner.Scan() { |
|
|
|
go func(scanner *bufio.Scanner, c chan<- ChatIn) { |
|
|
|
json.Unmarshal([]byte(scanner.Text()), &jsonData) |
|
|
|
var jsonData ChatIn |
|
|
|
c <- jsonData |
|
|
|
for scanner.Scan() { |
|
|
|
} |
|
|
|
json.Unmarshal([]byte(scanner.Text()), &jsonData) |
|
|
|
|
|
|
|
c <- jsonData |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}(scanner, c) |
|
|
|
|
|
|
|
keybaseListen.Wait() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Run() runs keybase chat api-listen, and passes incoming messages to the message handler func
|
|
|
|
// Run() runs keybase chat api-listen, and passes incoming messages to the message handler func
|
|
|
|