Update for logic for server_create.
[m6w6/libmemcached] / libtest / server.cc
index 0fd1bbf366bbce0465d6e03cf37b95a0545e6809..182e6f3ec2dad99b40b9e5a2fd505ec932640a0a 100644 (file)
@@ -70,7 +70,6 @@ std::ostream& operator<<(std::ostream& output, const Server &arg)
     output << " Exec:" <<  arg.running();
   }
 
-
   return output;  // for multiple << operators
 }
 
@@ -132,24 +131,30 @@ bool Server::start()
     Error << "Could not kill() existing server during start() pid:" << _pid;
     return false;
   }
-  assert(not has_pid());
 
-  Application app(name(), is_libtool());
+  if (has_pid() == false)
+  {
+    fatal_message("has_pid() failed, programer error");
+  }
+
+  Application app(executable(), is_libtool());
   if (args(app) == false)
   {
     Error << "Could not build command()";
     return false;
   }
 
-  if (Application::SUCCESS !=  app.run())
+  Application::error_t ret;
+  if (Application::SUCCESS !=  (ret= app.run()))
   {
-    Error << "Application::run()";
+    Error << "Application::run() " << ret;
     return false;
   }
+  _running= app.print();
 
-  if (Application::SUCCESS !=  app.wait())
+  if (Application::SUCCESS !=  (ret= app.wait()))
   {
-    Error << "Application::wait()";
+    Error << "Application::wait() " << app.print() << " " << ret;
     return false;
   }
 
@@ -327,9 +332,10 @@ bool Server::args(Application& app)
     app.add_option(daemon_file_option());
   }
 
-  if (_is_socket and has_socket_file_option())
+  if (has_socket_file_option())
   {
-    if (not set_socket_file())
+    Error << "adding socket option ";
+    if (set_socket_file() == false)
     {
       return false;
     }