Skip to content

Commit

Permalink
Fix capture method comparison
Browse files Browse the repository at this point in the history
If the default is "termshark", then termshark's dual-pronged
dumpcap-then-tshark capture method is used. But it's misleading to print
out that when termshark's capture failed, here is the stderr from the
failing capture program, "termshark". So I swap it out for some other
language in the default case. This compares the binaries properly, via
their full paths - if termshark is started as e.g. ./termshark, my
comparison failed.
  • Loading branch information
gcla committed Jul 4, 2022
1 parent 949dbf7 commit cd190f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/termshark/termshark.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,9 @@ func cmain() int {
// variable set that causes it to try dumpcap, then tshark, in that order (for
// efficiency of capture, but falling back to tshark for extcap interfaces).
// But telling the user the capture process is "termshark" is misleading.
cbin := termshark.CaptureBin()
if cbin == "termshark" {
cbin, err1 := filepath.Abs(filepath.FromSlash(termshark.CaptureBin()))
def, err2 := filepath.Abs("termshark")
if err1 == nil && err2 == nil && cbin == def {
cbin = "the capture process"
}

Expand Down

0 comments on commit cd190f7

Please sign in to comment.