Skip to content

Commit

Permalink
refactor(lsof): clean-up and simplify lsof usage (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
rinor authored Feb 6, 2023
1 parent 3667df3 commit 07d82d0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3,940 deletions.
8 changes: 4 additions & 4 deletions cmd/flags_run_local_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"debug/elf"
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"time"

"github.com/nanovms/ops/log"
Expand Down Expand Up @@ -142,10 +144,8 @@ func (flags *RunLocalInstanceCommandFlags) MergeToConfig(c *types.Config) error
conn.Close()

message := fmt.Sprintf("Port %v is being used by other application", port)
pid, err := checkPortUserPID(port)
if err != nil {
return err
}
lsofOut, _ := exec.Command("lsof", "-t", "-i", ":"+port).CombinedOutput()
pid := strings.TrimSpace(string(lsofOut))
if pid != "" {
message += fmt.Sprintf(" (PID %s)", pid)
}
Expand Down
41 changes: 0 additions & 41 deletions cmd/flags_run_local_instance_unix.go

This file was deleted.

Loading

0 comments on commit 07d82d0

Please sign in to comment.