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:
parent
29a289acf3
commit
8d91afc4ba
1
jstests/noPassthrough/libs/testWindowsExtension.bat
Executable file
1
jstests/noPassthrough/libs/testWindowsExtension.bat
Executable file
@ -0,0 +1 @@
|
||||
exit 42
|
17
jstests/noPassthrough/shell_check_program_extension.js
Normal file
17
jstests/noPassthrough/shell_check_program_extension.js
Normal 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.");
|
||||
}
|
||||
})();
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user