summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrahman1318 <tausif.rahman@mongodb.com>2022-01-24 20:51:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-24 22:02:03 +0000
commitac8581ed35cb4d1dd20d4ac034bce6a2be868916 (patch)
treecc5543baa1f3b7bd9f97bc27a47b123cf7038966
parent2d23c2650eee84f5bcbb9bef5acdad4a583d488b (diff)
downloadmongo-ac8581ed35cb4d1dd20d4ac034bce6a2be868916.tar.gz
SERVER-62927 Add disablePrint & enablePrint functions to mongo shell
-rw-r--r--src/mongo/shell/utils.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index ec5e7b92305..abfe6cce8de 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -194,6 +194,15 @@ shellPrint = function(x) {
shellPrintHelper(x);
};
+_originalPrint = print;
+disablePrint = function() {
+ print = Function.prototype;
+};
+
+enablePrint = function() {
+ print = _originalPrint;
+};
+
print.captureAllOutput = function(fn, args) {
var res = {};
res.output = [];