github.com/Cloud-Foundations/Dominator@v0.3.4/sub/rpcd/generateNote.go (about) 1 package rpcd 2 3 import ( 4 "os/exec" 5 "strings" 6 ) 7 8 func (t *rpcType) generateNote() (string, error) { 9 if t.config.NoteGeneratorCommand == "" { 10 return "", nil 11 } 12 cmd := exec.Command(t.config.NoteGeneratorCommand) 13 if output, err := cmd.Output(); err != nil { 14 return "", err 15 } else if length := len(output); length > 0 { 16 var note string 17 if length < 64 { 18 note = string(output) 19 } else { 20 note = string(output[:64]) 21 } 22 return strings.TrimSpace(note), nil 23 } 24 return "", nil 25 }