You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/03/01 00:04:06 UTC

[5/6] mesos git commit: Windows: Ported `mesos-execute`.

Windows: Ported `mesos-execute`.

This patch ports the `mesos-execute` CLI framework to Windows.

The change was to print an appropriate error message without the
calling `getuid` API, which doesn't exist on Windows.

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


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

Branch: refs/heads/master
Commit: 9732158894eaea56b60d71fc8ef039e5695bc834
Parents: 3dc7f84
Author: Sachin Paryani <sa...@gmail.com>
Authored: Wed Feb 28 11:12:34 2018 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Wed Feb 28 16:02:57 2018 -0800

----------------------------------------------------------------------
 src/cli/CMakeLists.txt | 13 +++++--------
 src/cli/execute.cpp    |  5 +++++
 2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/97321588/src/cli/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 06d9e62..7b2abf2 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -14,11 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# TODO(josephw): Enable this on Windows after sorting out the dependencies.
-if (NOT WIN32)
-  # THE MESOS EXECUTE.
-  # Utility used to schedule and run a command in a mesos cluster.
-  ################################################################
-  add_executable(mesos-execute execute.cpp)
-  target_link_libraries(mesos-execute PRIVATE mesos)
-endif ()
+# THE MESOS EXECUTE.
+# Utility used to schedule and run a command in a mesos cluster.
+################################################################
+add_executable(mesos-execute execute.cpp)
+target_link_libraries(mesos-execute PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/97321588/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index 221d65f..89e5130 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -976,7 +976,12 @@ int main(int argc, char** argv)
     if (user.isError()) {
       EXIT(EXIT_FAILURE) << "Failed to get username: " << user.error();
     } else {
+#ifndef __WINDOWS__
       EXIT(EXIT_FAILURE) << "No username for uid " << ::getuid();
+#else
+      // NOTE: The `::getuid()` function does not exist on Windows.
+      EXIT(EXIT_FAILURE) << "No username for current user";
+#endif // __WINDOWS__
     }
   }