0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-37096 shell now checks for missing extension before appending exe

This commit is contained in:
Jonathan 2018-12-06 15:10:09 -05:00
parent 29a289acf3
commit 8d91afc4ba
3 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1 @@
exit 42

View File

@ -0,0 +1,17 @@
/**
* Tests that the shell correctly checks for program extensions in Windows environments.
*/
(function() {
'use strict';
if (_isWindows()) {
const filename = 'jstests/noPassthrough/libs/testWindowsExtension.bat';
clearRawMongoProgramOutput();
const result = runMongoProgram(filename);
assert.eq(result, 42);
} else {
jsTestLog("This test is only relevant for Windows environments.");
}
})();

View File

@ -487,7 +487,7 @@ boost::filesystem::path ProgramRunner::findProgram(const string& prog) {
// (e.g., mongorestore-2.4) or just <utility>. For windows, the appropriate extension
// needs to be appended.
//
if (p.extension() != ".exe") {
if (!p.has_extension()) {
p = prog + ".exe";
}
#endif