Skip to content

Commit

Permalink
Merge pull request #32 from armosec/fix-lin
Browse files Browse the repository at this point in the history
fix get processes command
  • Loading branch information
refaelm92 authored Nov 14, 2023
2 parents a0f06bb + 2bf588d commit 3ebf690
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion s3connector/s3_localstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func getProcessesForPort(targetPort int) ([]int, error) {
case windows:
cmd = exec.Command("cmd", "/c", "netstat", "-ano", "|", "findstr", fmt.Sprintf(":%d", targetPort))
default:
cmd = exec.Command("sh", "-c", fmt.Sprintf("lsof -i tcp:%d | awk 'NR!=1 {print $2}'", targetPort))
cmd = exec.Command("sh", "-c", fmt.Sprintf("lsof -iTCP:%d -n -P | awk '/.*LISTEN.*/ { print $2 }'", targetPort))
}
output, err := cmd.Output()
if err != nil {
Expand Down

0 comments on commit 3ebf690

Please sign in to comment.