mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
Merge pull request #1087 from testwill/file_close
fix: close cpu profile
This commit is contained in:
commit
ca2e257fbb
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