MCPcopy
hub / github.com/wavetermdev/waveterm / IsWshVersionUpToDate

Function IsWshVersionUpToDate

pkg/remote/conncontroller/conncontroller.go:315–330  ·  view source on GitHub ↗

expects the output of `wsh version` which looks like `wsh v0.10.4` or "not-installed [os] [arch]" returns (up-to-date, semver, osArchStr, error) if not up to date, or error, version might be ""

(logCtx context.Context, wshVersionLine string)

Source from the content-addressed store, hash-verified

313// returns (up-to-date, semver, osArchStr, error)
314// if not up to date, or error, version might be ""
315func IsWshVersionUpToDate(logCtx context.Context, wshVersionLine string) (bool, string, string, error) {
316 wshVersionLine = strings.TrimSpace(wshVersionLine)
317 if strings.HasPrefix(wshVersionLine, "not-installed") {
318 return false, "not-installed", strings.TrimSpace(strings.TrimPrefix(wshVersionLine, "not-installed")), nil
319 }
320 parts := strings.Fields(wshVersionLine)
321 if len(parts) != 2 {
322 return false, "", "", fmt.Errorf("unexpected version format: %s", wshVersionLine)
323 }
324 clientVersion := parts[1]
325 expectedVersion := fmt.Sprintf("v%s", wavebase.WaveVersion)
326 if semver.Compare(clientVersion, expectedVersion) < 0 {
327 return false, clientVersion, "", nil
328 }
329 return true, clientVersion, "", nil
330}
331
332// for testing only -- trying to determine the env difference when attaching or not attaching a pty to an ssh session
333func (conn *SSHConn) GetEnvironmentMaps(ctx context.Context) (map[string]string, map[string]string, error) {

Callers 3

ConnUpdateWshCommandMethod · 0.92
StartConnServerMethod · 0.92
StartConnServerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected