mirror of
https://github.com/google/gops.git
synced 2024-11-24 08:22:25 +02:00
agent: check error return values (#109)
In func handle, check the error return values of pprof.WriteHeapProfile and trace.Start.
This commit is contained in:
parent
10df6abaad
commit
ccffbf8d4a
@ -228,7 +228,7 @@ func handle(conn io.ReadWriter, msg []byte) error {
|
||||
case signal.Version:
|
||||
fmt.Fprintf(conn, "%v\n", runtime.Version())
|
||||
case signal.HeapProfile:
|
||||
pprof.WriteHeapProfile(conn)
|
||||
return pprof.WriteHeapProfile(conn)
|
||||
case signal.CPUProfile:
|
||||
if err := pprof.StartCPUProfile(conn); err != nil {
|
||||
return err
|
||||
@ -254,7 +254,9 @@ func handle(conn io.ReadWriter, msg []byte) error {
|
||||
_, err = bufio.NewReader(f).WriteTo(conn)
|
||||
return err
|
||||
case signal.Trace:
|
||||
trace.Start(conn)
|
||||
if err := trace.Start(conn); err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
trace.Stop()
|
||||
case signal.SetGCPercent:
|
||||
|
Loading…
Reference in New Issue
Block a user