Skip to content

Commit 61141d8

Browse files
authored
fix: use setupRepl when connecting with username/password (#184)
1 parent 8e9f6b7 commit 61141d8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/cli-repl/src/cli-repl.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,17 @@ class CliRepl {
336336
replace: '*'
337337
};
338338
read(readOptions, (error, password) => {
339-
if (error) return console.log(formatError(error));
339+
if (error) {
340+
this.bus.emit('mongosh:error', error);
341+
return console.log(formatError(error));
342+
}
340343

341344
driverOptions.auth.password = password;
342-
this.connect(driverUri, driverOptions);
345+
this.setupRepl(driverUri, driverOptions).catch((e) => {
346+
this.bus.emit('mongosh:error', e);
347+
console.log(formatError(e));
348+
return;
349+
});
343350
});
344351
}
345352
}

0 commit comments

Comments
 (0)