You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2017/10/20 22:16:02 UTC

[2/3] mesos git commit: Moved the search for the containerizer executable launch path.

Moved the search for the containerizer executable launch path.

Improved code readability by hoisting the code that searches for
the containerizer executable launch path up to be near where the
executable path is first determined.

Review: https://reviews.apache.org/r/63190/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/45c50792
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/45c50792
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/45c50792

Branch: refs/heads/master
Commit: 45c50792f609beebc34b67a583407bcf187eee64
Parents: 6a41196
Author: James Peach <jp...@apache.org>
Authored: Fri Oct 20 14:57:52 2017 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Oct 20 14:57:52 2017 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/launch.cpp | 36 +++++++++++++--------------
 1 file changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/45c50792/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index 8deb7fd..fc5bd3d 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -709,6 +709,24 @@ int MesosContainerizerLaunch::execute()
     ? os::Shell::name
     : launchInfo.command().value().c_str());
 
+#ifndef __WINDOWS__
+  // Search executable in the current working directory as well.
+  // execvpe and execvp will only search executable from the current
+  // working directory if environment variable PATH is not set.
+  // TODO(aaron.wood): 'os::which' current does not work on Windows.
+  // Remove the ifndef guard once it's supported on Windows.
+  if (!path::absolute(executable) &&
+      launchInfo.has_working_directory()) {
+    Option<string> which = os::which(
+        executable,
+        launchInfo.working_directory());
+
+    if (which.isSome()) {
+      executable = which.get();
+    }
+  }
+#endif // __WINDOWS__
+
   os::raw::Argv argv(launchInfo.command().shell()
     ? vector<string>({
           os::Shell::arg0,
@@ -837,24 +855,6 @@ int MesosContainerizerLaunch::execute()
   }
 #endif // __WINDOWS__
 
-#ifndef __WINDOWS__
-  // Search executable in the current working directory as well.
-  // execvpe and execvp will only search executable from the current
-  // working directory if environment variable PATH is not set.
-  // TODO(aaron.wood): 'os::which' current does not work on Windows.
-  // Remove the ifndef guard once it's supported on Windows.
-  if (!path::absolute(executable) &&
-      launchInfo.has_working_directory()) {
-    Option<string> which = os::which(
-        executable,
-        launchInfo.working_directory());
-
-    if (which.isSome()) {
-      executable = which.get();
-    }
-  }
-#endif // __WINDOWS__
-
   if (envp.isSome()) {
     os::execvpe(executable.c_str(), argv, envp.get());
   } else {