You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/01/31 23:11:33 UTC

svn commit: r1238829 - in /incubator/mesos/trunk: bin/mesos-build-env.sh.in src/common/process_utils.hpp src/common/utils.hpp

Author: benh
Date: Tue Jan 31 22:11:33 2012
New Revision: 1238829

URL: http://svn.apache.org/viewvc?rev=1238829&view=rev
Log:
Fixes issues with running the killtree.sh script.

Modified:
    incubator/mesos/trunk/bin/mesos-build-env.sh.in
    incubator/mesos/trunk/src/common/process_utils.hpp
    incubator/mesos/trunk/src/common/utils.hpp

Modified: incubator/mesos/trunk/bin/mesos-build-env.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/mesos-build-env.sh.in?rev=1238829&r1=1238828&r2=1238829&view=diff
==============================================================================
--- incubator/mesos/trunk/bin/mesos-build-env.sh.in (original)
+++ incubator/mesos/trunk/bin/mesos-build-env.sh.in Tue Jan 31 22:11:33 2012
@@ -29,3 +29,4 @@ export MESOS_WEBUI_DIR
 export MESOS_LAUNCHER_DIR
 export MESOS_LOG_DIR
 export MESOS_WORK_DIR
+export MESOS_KILLTREE
\ No newline at end of file

Modified: incubator/mesos/trunk/src/common/process_utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/process_utils.hpp?rev=1238829&r1=1238828&r2=1238829&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/process_utils.hpp (original)
+++ incubator/mesos/trunk/src/common/process_utils.hpp Tue Jan 31 22:11:33 2012
@@ -22,9 +22,9 @@
 #include <iostream>
 #include <sstream>
 
+#include "common/strings.hpp"
 #include "common/utils.hpp"
 
-
 namespace mesos {
 namespace internal {
 namespace utils {
@@ -37,6 +37,7 @@ inline Try<int> killtree(
     bool killsess)
 {
   std::string cmdline;
+
   // TODO(Charles Reiss): Use a configuration option.
   if (utils::os::hasenv("MESOS_KILLTREE")) {
     // Set by mesos-build-env.sh.
@@ -44,12 +45,17 @@ inline Try<int> killtree(
   } else if (utils::os::hasenv("MESOS_SOURCE_DIR")) {
     // Set by test harness for external tests.
     cmdline = utils::os::getenv("MESOS_SOURCE_DIR") +
-        "/src/scripts/killtree.sh";
+      "/src/scripts/killtree.sh";
   } else {
     cmdline = MESOS_LIBEXECDIR "/killtree.sh";
   }
-  cmdline += " -p " + pid;
-  cmdline += " -s " + signal;
+
+  // Add the arguments.
+  Try<std::string> args = strings::format(" -p %d -s %d", pid, signal);
+  CHECK(!args.isError()) << args.error();
+  cmdline += args.get();
+
+  // Also add flags to kill all encountered groups and sessions.
   if (killgroups) cmdline += " -g";
   if (killsess) cmdline += " -x";
 

Modified: incubator/mesos/trunk/src/common/utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/utils.hpp?rev=1238829&r1=1238828&r2=1238829&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/utils.hpp (original)
+++ incubator/mesos/trunk/src/common/utils.hpp Tue Jan 31 22:11:33 2012
@@ -40,6 +40,7 @@
 
 #include <google/protobuf/io/zero_copy_stream_impl.h>
 
+#include <iostream>
 #include <list>
 #include <set>