X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.cc;h=a5d801a6fb00b4b4006973b07a309e8c3e26e2d9;hb=2d9bd6ba5e72099ae4c5287ade99300c7f6bd1b7;hp=78b729f96cb473faeeef973e325865cb0a28689f;hpb=999006a8904a0f08293f1df7bda81bff914b091a;p=m6w6%2Flibmemcached diff --git a/libtest/server.cc b/libtest/server.cc index 78b729f9..a5d801a6 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -148,9 +148,14 @@ bool Server::cycle() bool Server::wait_for_pidfile() const { - Wait wait(pid_file(), 4); + if (has_pid_file()) + { + Wait wait(pid_file(), 4); + + return wait.successful(); + } - return wait.successful(); + return true; } bool Server::has_pid() const @@ -206,29 +211,33 @@ bool Server::start() dream(5, 50000); } - size_t repeat= 5; _app.slurp(); - while (--repeat) + if (has_pid_file()) { - if (pid_file().empty() == false) + size_t repeat= 5; + while (--repeat) { - Wait wait(pid_file(), 8); - - if (wait.successful() == false) + if (pid_file().empty() == false) { - if (_app.check()) + Error << " here?"; + Wait wait(pid_file(), 8); + + if (wait.successful() == false) { - _app.slurp(); - continue; + if (_app.check()) + { + _app.slurp(); + continue; + } + + char buf[PATH_MAX]; + char *getcwd_buf= getcwd(buf, sizeof(buf)); + throw libtest::fatal(LIBYATL_DEFAULT_PARAM, + "Unable to open pidfile in %s for: %s stderr:%s", + getcwd_buf ? getcwd_buf : "", + _running.c_str(), + _app.stderr_c_str()); } - - char buf[PATH_MAX]; - char *getcwd_buf= getcwd(buf, sizeof(buf)); - throw libtest::fatal(LIBYATL_DEFAULT_PARAM, - "Unable to open pidfile in %s for: %s stderr:%s", - getcwd_buf ? getcwd_buf : "", - _running.c_str(), - _app.stderr_c_str()); } } } @@ -406,6 +415,7 @@ bool Server::args(Application& app) } // Update pid_file + if (has_pid_file()) { if (_pid_file.empty() and set_pid_file() == false) {