github.com/pquerna/agent@v2.1.8+incompatible/proctitle/proctitle_linux_amd64.go (about)

     1  // +build linux,amd64,cgo
     2  
     3  package proctitle
     4  
     5  import (
     6  	"strings"
     7  
     8  	"github.com/ErikDubbelboer/gspt"
     9  )
    10  
    11  func Replace(title string) {
    12  	length := len(title)
    13  
    14  	if length >= 255 {
    15  		length = 255
    16  		gspt.SetProcTitle(title[:255])
    17  	} else {
    18  		title += strings.Repeat(" ", 255-length)
    19  		gspt.SetProcTitle(title)
    20  	}
    21  }