diff options
author | Alan Conway <aconway@apache.org> | 2009-10-13 19:53:43 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-10-13 19:53:43 +0000 |
commit | 220d63cd604614e62f188e0b7749fd6080cf6800 (patch) | |
tree | 204369eda6e916c8c5da69d2a2585ded90a5aab8 /qpid/cpp/src/posix | |
parent | 37808d6377cb46cc33e44e864508474fd2246592 (diff) | |
download | qpid-python-220d63cd604614e62f188e0b7749fd6080cf6800.tar.gz |
Have qpidd -q wait till the qpidd process exits before returning.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@824894 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/posix')
-rw-r--r-- | qpid/cpp/src/posix/QpiddBroker.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qpid/cpp/src/posix/QpiddBroker.cpp b/qpid/cpp/src/posix/QpiddBroker.cpp index aa934571be..3a20087062 100644 --- a/qpid/cpp/src/posix/QpiddBroker.cpp +++ b/qpid/cpp/src/posix/QpiddBroker.cpp @@ -144,8 +144,16 @@ int QpiddBroker::execute (QpiddOptions *options) { return 1; if (myOptions->daemon.check) cout << pid << endl; - if (myOptions->daemon.quit && kill(pid, SIGINT) < 0) - throw Exception("Failed to stop daemon: " + qpid::sys::strError(errno)); + if (myOptions->daemon.quit) { + if (kill(pid, SIGINT) < 0) + throw Exception("Failed to stop daemon: " + qpid::sys::strError(errno)); + // Wait for the process to die before returning + int retry=10000; // Try up to 10 seconds + while (kill(pid,0) == 0 && --retry) + sys::usleep(1000); + if (retry == 0) + throw Exception("Gave up waiting for daemon process to exit"); + } return 0; } |