Skip to content

Commit

Permalink
slightly fix ui/shell.go
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyangyu committed Sep 30, 2024
1 parent c9790b5 commit 7b1536e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/util/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package util
import (
"context"
"crypto/tls"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -84,7 +85,7 @@ func generateDsnWithPassword(clusterType string, userName string, host string, p
} else if clusterType == DEDICATED {
dsn = fmt.Sprintf("tidb://%s:%s@%s:%s?tls=skip-verify", userName, pass, host, port)
} else {
return "", fmt.Errorf("unsupproted cluster type: %s", clusterType)
return "", fmt.Errorf("unsupported cluster type: %s", clusterType)
}
return dsn, nil
}
Expand All @@ -103,13 +104,13 @@ func generateDsnWithoutPassword(clusterType string, userName string, host string
} else if clusterType == DEDICATED {
dsn = fmt.Sprintf("tidb://%s@%s:%s?tls=skip-verify", userName, host, port)
} else {
return "", fmt.Errorf("unsupproted cluster type: %s", clusterType)
return "", fmt.Errorf("unsupported cluster type: %s", clusterType)
}

// Prompt for password
dsn, err := h.Password(dsn)
if err != nil {
return "", err
if err != nil && errors.Is(err, rline.ErrInterrupt) {
return "", InterruptError
}
return dsn, nil
return dsn, err
}

0 comments on commit 7b1536e

Please sign in to comment.