summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mir <ali.mir@mongodb.com>2020-09-11 14:07:06 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-07 00:56:32 +0000
commit872b733e4bfebd4572ed18992fe7649f9250ad9f (patch)
treeb13fbd965daf517e230d01a7a9ee3394f125f6f5
parent9b94db8b248cf48c3ea07f3ad6675b96977c80ee (diff)
downloadmongo-872b733e4bfebd4572ed18992fe7649f9250ad9f.tar.gz
SERVER-50072 Check _isWindows() when initializing MongoRunner.EXIT_ABORT
(cherry picked from commit 8797f3b34d6602db8b44f93e345cec38058508e5)
-rw-r--r--jstests/replsets/oplog_replay_on_startup_with_bad_op.js5
-rw-r--r--src/mongo/shell/servers.js3
2 files changed, 3 insertions, 5 deletions
diff --git a/jstests/replsets/oplog_replay_on_startup_with_bad_op.js b/jstests/replsets/oplog_replay_on_startup_with_bad_op.js
index d9d3afca25d..d7c64450f40 100644
--- a/jstests/replsets/oplog_replay_on_startup_with_bad_op.js
+++ b/jstests/replsets/oplog_replay_on_startup_with_bad_op.js
@@ -57,9 +57,6 @@ assert.eq(minValidColl.findOne(),
assert.throws(() => rst.restart(0)); // Restart in replSet mode again.
-// fassert() calls std::abort(), which returns a different exit code for Windows vs. other
-// platforms.
-const exitCode = _isWindows() ? MongoRunner.EXIT_ABRUPT : MongoRunner.EXIT_ABORT;
-rst.stop(0, undefined, {allowedExitCode: exitCode});
+rst.stop(0, undefined, {allowedExitCode: MongoRunner.EXIT_ABORT});
rst.stopSet();
})();
diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js
index 96c116a5927..7241cbe9111 100644
--- a/src/mongo/shell/servers.js
+++ b/src/mongo/shell/servers.js
@@ -817,7 +817,8 @@ MongoRunner.StopError.prototype = Object.create(Error.prototype);
MongoRunner.StopError.prototype.constructor = MongoRunner.StopError;
// Constants for exit codes of MongoDB processes
-MongoRunner.EXIT_ABORT = -6;
+// On Windows, std::abort causes the process to exit with return code 14.
+MongoRunner.EXIT_ABORT = _isWindows() ? 14 : -6;
MongoRunner.EXIT_CLEAN = 0;
MongoRunner.EXIT_BADOPTIONS = 2;
MongoRunner.EXIT_REPLICATION_ERROR = 3;