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 2011/06/05 10:26:32 UTC

svn commit: r1132028 - /incubator/mesos/trunk/src/examples/memhog.cpp

Author: benh
Date: Sun Jun  5 08:26:32 2011
New Revision: 1132028

URL: http://svn.apache.org/viewvc?rev=1132028&view=rev
Log:
Fixed the way memhog locates its executor.

Modified:
    incubator/mesos/trunk/src/examples/memhog.cpp

Modified: incubator/mesos/trunk/src/examples/memhog.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/examples/memhog.cpp?rev=1132028&r1=1132027&r2=1132028&view=diff
==============================================================================
--- incubator/mesos/trunk/src/examples/memhog.cpp (original)
+++ incubator/mesos/trunk/src/examples/memhog.cpp Sun Jun  5 08:26:32 2011
@@ -1,5 +1,7 @@
 #include <mesos_sched.hpp>
 
+#include <libgen.h>
+
 #include <cstdlib>
 #include <iostream>
 #include <sstream>
@@ -91,9 +93,10 @@ int main(int argc, char ** argv) {
          << " <MB_to_request> <MB_per_task>" << endl;
     return -1;
   }
-  char cwd[4096];
-  getcwd(cwd, sizeof(cwd));
-  string executor = string(cwd) + "/memhog-executor";
+  // Find this executable's directory to locate executor
+  char buf[4096];
+  realpath(dirname(argv[0]), buf);
+  string executor = string(buf) + "/memhog-executor";
   MyScheduler sched(executor,
                     lexical_cast<int>(argv[2]),
                     lexical_cast<double>(argv[3]),