From 5ae4dcc8bafc6db009ff582e669438b5cb2f7967 Mon Sep 17 00:00:00 2001 From: Shirou WAKAYAMA Date: Sun, 11 Oct 2015 22:07:18 +0900 Subject: [PATCH] net[linux]: fix lsof output in linux when no pid outputed. --- common/common_unix.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/common_unix.go b/common/common_unix.go index 66284cc..21aaa1e 100644 --- a/common/common_unix.go +++ b/common/common_unix.go @@ -22,11 +22,10 @@ func CallLsof(invoke Invoker, pid int32, args ...string) ([]string, error) { } out, err := invoke.Command(lsof, cmd...) if err != nil { - // if no pid found, lsof returnes code 1 + // if no pid found, lsof returnes code 1 but have output. if err.Error() == "exit status 1" && len(out) == 0 { - return []string{}, nil + return []string{}, err } - return []string{}, err } lines := strings.Split(string(out), "\n")