This is an automated email from the ASF dual-hosted git repository. klueska pushed a commit to branch 1.6.x in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 943b8f29beaa3d82a9fe97983f2f9cae9f33f49c Author: Kevin Klues <klue...@gmail.com> AuthorDate: Tue Oct 2 11:40:52 2018 +0200 Added the ability to launch tasks with a TTY attached to mesos-execute. Review: https://reviews.apache.org/r/68724/ --- src/cli/execute.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp index 89e5130..9e7c511 100644 --- a/src/cli/execute.cpp +++ b/src/cli/execute.cpp @@ -356,6 +356,11 @@ public: "and 'protobuf' are valid choices.", "protobuf"); + add(&Flags::tty, + "tty", + "Attach a TTY to the task being launched", + false); + add(&Flags::partition_aware, "partition_aware", "Enable partition-awareness for the framework.", @@ -390,6 +395,7 @@ public: Option<string> secret; string content_type; bool partition_aware; + bool tty; }; @@ -787,7 +793,8 @@ static Result<ContainerInfo> getContainerInfo( const Option<string>& dockerImage, const Option<CapabilityInfo>& effective_capabilities, const Option<CapabilityInfo>& bounding_capabilities, - const Option<RLimitInfo>& rlimits) + const Option<RLimitInfo>& rlimits, + const bool tty) { if (containerizer.empty()) { return None(); @@ -870,6 +877,10 @@ static Result<ContainerInfo> getContainerInfo( containerInfo.mutable_rlimit_info()->CopyFrom(rlimits.get()); } + if (tty) { + containerInfo.mutable_tty_info(); + } + return containerInfo; } else if (containerizer == "docker") { // 'docker' containerizer only supports 'docker' images. @@ -892,6 +903,10 @@ static Result<ContainerInfo> getContainerInfo( } } + if (tty) { + return Error("'Docker' containerizer does not allow attaching a TTY"); + } + return containerInfo; } @@ -1190,7 +1205,8 @@ int main(int argc, char** argv) dockerImage, flags.effective_capabilities, flags.bounding_capabilities, - flags.rlimits); + flags.rlimits, + flags.tty); if (containerInfo.isError()){ EXIT(EXIT_FAILURE) << containerInfo.error();