$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [process] Formal Review starts today, 27 October
From: Klemens Morgenstern (klemens.morgenstern_at_[hidden])
Date: 2016-11-10 07:30:35
>>>
>>  [...]
>>  [...]
>>  [...]
>>> `launch` returns a callable that accepts 0 or more `properties` to
>>> launch the process. Example:
>>>
>>>    class launcher {
>>>      std::string exe_;
>>>      std::vector<std::string> args_;
>>>    public:
>>>      launcher(std::string exe, std::vector<std::string> args)
>>>        : exe_(std::move(exe)), args_(std::move(args)) {
>>>      }
>>>
>>>      template<typename... Props>
>>>      child operator()(Props&&... props) const {
>>>        return detail::exec(exe_, args_,
>>> std::forward<Props>(props)...); }
>>>    };
>>>    struct launch_ {
>>>      template<typename... Args>
>>>      launcher operator()(std::string exe, Args&&... args) const {
>>>        return {std::move(exe), {std::forward<Args>(args)...}};
>>>      }
>>>    };
>>>    constexpr launch_ launch{};
>>>
>>>    // syntax:
>>>    //   launch("ls", "-la", "/")(stdout(my_pipe));
>> Yeah, that still doesn't work. When do you launcht process? Please
>> think those Ideas through, if you want me to take them serious. If
>> you launch at the call of "launch("ls", "-la", "/") than you couldn't
>> bind stdout. If you launch after the binding of stdout, how would you
>> append another paremeter? It's broken.
I forgot: you can write all of this very easily:
struct launch
{
     std::string exe;
     std::vector<std::string> args;
     launch(const std::string & exe,
                    const std::vector<std::string> &args)
                        : exe(exe), args(args) {}
     template<typename ... Args>
     bp::child operator()(Args && ... args)
     { return bp::child(bp::exe=exe, bp::args=args, 
std::forward<Args>(args)...); }
};
>>>
>>>    bp::shell("ls -la /", bp::stdout(my_pipe));
>>>    bp::launch("ls", {"-la", "/"}, bp::stdout(my_pipe));
>>>    bp::launch("foo", {}, bp::stdout(my_pipe));
>>>
Same here:
template<typename ... Args>
void shell(const std::string & cmd, Args &&...args)
{
     bp::spawn(bp::cmd=cmd, bp::shell, std::forward<Args>(args)...);
}
template<typename ... Args>
void launch(const std::string & exe, const std::vector<std::string> & 
args, Args && .. args)
{
     bp::spawn(bp::exe=exe, bp::ars=args, std::forward<Args>(args)...);
}