From cd190f7ef58cf4246ffa3702f252fdb000d08882 Mon Sep 17 00:00:00 2001 From: Graham Clark Date: Mon, 4 Jul 2022 13:01:52 -0400 Subject: [PATCH] Fix capture method comparison 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. --- cmd/termshark/termshark.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/termshark/termshark.go b/cmd/termshark/termshark.go index 69a496e..138edfe 100644 --- a/cmd/termshark/termshark.go +++ b/cmd/termshark/termshark.go @@ -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" }