DetectVersion returns the tool's version string by running ` --version`. Returns "unknown" when the binary is missing or every probe fails (including timeout). Prefer Detect when the installed flag is also needed.
(tool Tool)
| 177 | // Returns "unknown" when the binary is missing or every probe fails (including |
| 178 | // timeout). Prefer Detect when the installed flag is also needed. |
| 179 | func DetectVersion(tool Tool) string { |
| 180 | bin := tool.LaunchCommand() |
| 181 | if bin == "" { |
| 182 | return "unknown" |
| 183 | } |
| 184 | return detectVersion(bin) |
| 185 | } |
| 186 | |
| 187 | // detectVersion probes the binary with a sequence of version flags, returning |
| 188 | // the first non-empty response. Each probe is bounded: the process is killed |
nothing calls this directly
no test coverage detected