summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2016-09-07 14:18:23 -0400
committerJonathan Reams <jbreams@mongodb.com>2016-09-16 10:18:34 -0400
commite3b42fd990070f48c11b233cec0c198098d1a48f (patch)
tree464665d664b18fe709ccf5e9d039a424b9489a12 /src/mongo/shell
parent7693fa59c4470db729d85af99fb9cc3b264fa8c8 (diff)
downloadmongo-e3b42fd990070f48c11b233cec0c198098d1a48f.tar.gz
SERVER-26002 Make sure javascript sleep isn't interrupted
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/shell_utils_launcher.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp
index d69bdc6452b..b95e814777e 100644
--- a/src/mongo/shell/shell_utils_launcher.cpp
+++ b/src/mongo/shell/shell_utils_launcher.cpp
@@ -656,7 +656,10 @@ bool wait_for_pid(ProcessId pid, bool block = true, int* exit_code = NULL) {
}
#else
int tmp;
- bool ret = (pid.toNative() == waitpid(pid.toNative(), &tmp, (block ? 0 : WNOHANG)));
+ int ret;
+ do {
+ ret = waitpid(pid.toNative(), &tmp, (block ? 0 : WNOHANG));
+ } while (ret == -1 && errno == EINTR);
if (ret && exit_code) {
if (WIFEXITED(tmp)) {
*exit_code = WEXITSTATUS(tmp);
@@ -666,7 +669,7 @@ bool wait_for_pid(ProcessId pid, bool block = true, int* exit_code = NULL) {
MONGO_UNREACHABLE;
}
}
- return ret;
+ return ret == pid.toNative();
#endif
}