erikdubbelboer / gspt

setproctitle() for Go
MIT License
107 stars 22 forks source link

empty process title until one is set #1

Closed ekle closed 10 years ago

ekle commented 10 years ago

hi, if you include this package, the gspt.init() clears the process-title. so the process title is empty till the program calls gspt.SetProcTitle.

example: package main import ( "time" "github.com/ErikDubbelboer/gspt" ) func main() { time.Sleep(10000 * time.Millisecond) gspt.SetProcTitle("new title") // till this line ps shows an empty title time.Sleep(10000 * time.Millisecond) }

erikdubbelboer commented 10 years ago

This should be fixed in the new version.

ekle commented 10 years ago

hi, thanks for the fast fix but this way we loose any args of the the process in /proc/$pid/cmdline. SetProcTitle(strings.Join(os.Args, " ")); should be able to solve this. but wouldn't it be cleaner to make a copy of the cmdline before it is cleaned and then reset it to this value ?