Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46ebc86

Browse files
committed
Fix version string parsing
1 parent 544338d commit 46ebc86

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

cli/server.go

+1
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code
403403
if err != nil {
404404
return xerrors.Errorf("scan version: %w", err)
405405
}
406+
versionStr = strings.Split(versionStr, " ")[0]
406407
if semver.Compare("v"+versionStr, "v13") < 0 {
407408
return xerrors.New("PostgreSQL version must be v13.0.0 or higher!")
408409
}

cli/server_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ func TestServer(t *testing.T) {
6060
"--postgres-url", connectionURL,
6161
"--cache-dir", t.TempDir(),
6262
)
63+
pty := ptytest.New(t)
64+
root.SetOutput(pty.Output())
65+
root.SetErr(pty.Output())
6366
errC := make(chan error, 1)
6467
go func() {
6568
errC <- root.ExecuteContext(ctx)

0 commit comments

Comments
 (0)