mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 14:03:17 -07:00
fix: close cpu profile
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
parent
924ff5753d
commit
043bd4593b
1 changed files with 5 additions and 2 deletions
|
@ -120,9 +120,12 @@ func New() (*Session, error) {
|
|||
}
|
||||
|
||||
if *s.Options.CpuProfile != "" {
|
||||
if f, err := os.Create(*s.Options.CpuProfile); err != nil {
|
||||
f, err := os.Create(*s.Options.CpuProfile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if err := pprof.StartCPUProfile(f); err != nil {
|
||||
}
|
||||
defer f.Close()
|
||||
if err := pprof.StartCPUProfile(f); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue