Skip to content

Commit 3a4a744

Browse files
committed
CLOUDP-288455 Atlas CLI shows error message when connecting to deployment through Compass
1 parent 42958b7 commit 3a4a744

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

internal/compass/compass.go

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@
1515
package compass
1616

1717
import (
18-
"context"
1918
"errors"
20-
"fmt"
21-
"time"
2219
)
2320

24-
const waitForRunningStateDuration = 10 * time.Second
25-
2621
var (
27-
errCompassExited = errors.New("MongoDB Compass process has exited")
2822
ErrCompassNotInstalled = errors.New("did not find MongoDB Compass, install: https://dochub.mongodb.org/core/install-compass")
2923
)
3024

@@ -36,29 +30,5 @@ func Run(username, password, mongoURI string) error {
3630
path := binPath()
3731

3832
cmd := compassCmd(path, username, password, mongoURI)
39-
if err := cmd.Start(); err != nil {
40-
return err
41-
}
42-
43-
ctx, cancel := context.WithTimeout(context.Background(), waitForRunningStateDuration)
44-
defer cancel()
45-
46-
processExited := make(chan error)
47-
48-
// Check if the process is still running
49-
go func() {
50-
if err := cmd.Wait(); err != nil {
51-
processExited <- fmt.Errorf("MongoDB Compass failed to start: %w", err)
52-
} else {
53-
processExited <- errCompassExited
54-
}
55-
}()
56-
57-
select {
58-
case <-ctx.Done():
59-
// compass still running
60-
return nil
61-
case err := <-processExited:
62-
return err
63-
}
33+
return cmd.Start()
6434
}

0 commit comments

Comments
 (0)