Updating boost process for supressing console out
This commit is contained in:
parent
b59fe17562
commit
7b18403310
4 changed files with 22 additions and 3 deletions
|
|
@ -79,6 +79,14 @@ public:
|
||||||
return (it != handles_.end()) ? it->second : handle();
|
return (it != handles_.end()) ? it->second : handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BOOST_WINDOWS_API)
|
||||||
|
handle::native_type get_os_handle() const
|
||||||
|
{
|
||||||
|
return handle_.native();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Handles providing access to streams attached to the child process.
|
* Handles providing access to streams attached to the child process.
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,11 @@ struct context
|
||||||
*/
|
*/
|
||||||
environment env;
|
environment env;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppress creation of a console window on win32 (nop on other platforms)
|
||||||
|
*/
|
||||||
|
bool suppress_console;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a process context.
|
* Constructs a process context.
|
||||||
*
|
*
|
||||||
|
|
@ -91,7 +96,8 @@ struct context
|
||||||
*/
|
*/
|
||||||
context()
|
context()
|
||||||
: work_dir(self::get_work_dir()),
|
: work_dir(self::get_work_dir()),
|
||||||
env(self::get_environment())
|
env(self::get_environment()),
|
||||||
|
suppress_console(false)
|
||||||
{
|
{
|
||||||
#if 0 // this default behavior will throw in non-console apps
|
#if 0 // this default behavior will throw in non-console apps
|
||||||
#if defined(BOOST_POSIX_API)
|
#if defined(BOOST_POSIX_API)
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,11 @@ inline child create_child(const std::string &executable, Arguments args,
|
||||||
boost::shared_array<char> envstrs =
|
boost::shared_array<char> envstrs =
|
||||||
detail::environment_to_windows_strings(ctx.env);
|
detail::environment_to_windows_strings(ctx.env);
|
||||||
|
|
||||||
if (CreateProcessA(exe.get(), cmdline.get(), NULL, NULL, TRUE, 0,
|
DWORD creation_flags = 0;
|
||||||
|
if (ctx.suppress_console)
|
||||||
|
creation_flags |= CREATE_NO_WINDOW;
|
||||||
|
|
||||||
|
if (CreateProcessA(exe.get(), cmdline.get(), NULL, NULL, TRUE, creation_flags,
|
||||||
envstrs.get(), workdir.get(), &startup_info, &pi) == 0)
|
envstrs.get(), workdir.get(), &startup_info, &pi) == 0)
|
||||||
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateProcess() failed");
|
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateProcess() failed");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,11 +198,12 @@ private:
|
||||||
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed");
|
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed");
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* The process handle.
|
* The process handle.
|
||||||
*/
|
*/
|
||||||
handle handle_;
|
handle handle_;
|
||||||
|
private:
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue