[ 
https://issues.apache.org/jira/browse/MESOS-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14033160#comment-14033160
 ] 

Jie Yu commented on MESOS-1487:
-------------------------------

OK, had a discussion with [~benjaminhindman], the above interface is not quite 
nice when a user want to redirect to a file. He/she has to open the file, pass 
in the file descriptor and close the file after. We decided to have an 
interface like the following:

{noformat}
struct IO
{
    enum Mode
    {
        PIPE,
        FD,
        PATH
    } mode;
    int fd;
    string path;
};

Try<Subprocess> subprocess(
    const std::string& command,
    const Subprocess::IO& in,
    const Subprocess::IO& out,
    const Subprocess::IO& err,
    const Option<std::map<std::string, std::string> >& environment = None(),
    const Option<lambda::function<int()> >& setup = None());
{noformat}

> Improve Subprocess to support non-pipe mode
> -------------------------------------------
>
>                 Key: MESOS-1487
>                 URL: https://issues.apache.org/jira/browse/MESOS-1487
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Jie Yu
>            Assignee: Jie Yu
>
> Currently, we always create a pipe when using subprocess. This is not desired 
> in some cases. In some situation, we may just want the subprocess to inherit 
> the file handles from the parent (or redirect to a file).
> We can mimic the Python subprocess interface to support those modes. The user 
> can specify: PIPE, a existing file descriptor, or None for 
> stdin/stdout/stderr.
> Try<Subprocess> subprocess(
>     const std::string& command,
>     const Option<int>& stdin = Subprocess::PIPE,
>     const Option<int>& stdout = Subprocess::PIPE,
>     const Option<int>& stderr = Subprocess::PIPE,
>     const Option<std::map<std::string, std::string> >& environment = None(),
>     const Option<lambda::function<int()> >& setup = None());



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to