Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::process
From: Chris Rodgers (christopher.rodgers_at_[hidden])
Date: 2017-10-05 21:14:57


To answer my own question - this is one working possibility using
boost::process::extend...

#include <boost/process.hpp>
#include <boost/process/extend.hpp>

int main()
{
        boost::filesystem::path myPath(".........toRun.exe.......");

        auto set_own_window = [](auto & exec)
        {
            exec.creation_flags |=
boost::detail::winapi::CREATE_NEW_CONSOLE_;
            std::cerr << "in set_own_window" << std::endl; /* just for
debugging */
        };

        bp::child c(myPath, "argument1",
boost::process::extend::on_setup=set_own_window);

    return 0;
}

This works. Is it the right approach, or is there a better way?

Best wishes,

Chris.

On 05/10/2017 17:14, Chris Rodgers wrote:
> Hi,
>
> I'm trying to use Boost 1.65.1's boost::process::child in a Windows
> console program.
>
> At the moment, the child process is launched in the same console window
> as the parent.
>
> Is there an option to make a new console window for the child?
>
> The pre-boost-incorporation version of boost::process seemed to allow
> manipulation of the startupInfo struct directly (e.g.
> https://stackoverflow.com/questions/43582022/boostprocess-hide-console-on-windows/43583001)
> and then a win32_launch call. But this seems to have been removed now?
>
> Any tips gratefully received.
>
> Thanks,
>
> Chris.
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net