1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-28 13:48:49 +08:00

Merge pull request #880 from Lomanic/issue867

[process][darwin][nocgo] Fix #867 iterate on every lines returned by lsof to handle potential warnings
This commit is contained in:
Lomanic 2020-05-31 10:18:36 +02:00 committed by GitHub
commit a303ddc7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
}
txtFound := 0
lines := strings.Split(string(out), "\n")
for i := 1; i < len(lines); i += 2 {
for i := 1; i < len(lines); i++ {
if lines[i] == "ftxt" {
txtFound++
if txtFound == 2 {