Skip to content

Commit

Permalink
Updating boost process for supressing console out
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemaster committed Jun 27, 2013
1 parent b59fe17 commit 7b18403
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
8 changes: 8 additions & 0 deletions vendor/boost_1.51/include/boost/process/child.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ class child : public process
return (it != handles_.end()) ? it->second : handle();
}

#if defined(BOOST_WINDOWS_API)
handle::native_type get_os_handle() const
{
return handle_.native();
}
#endif


private:
/**
* Handles providing access to streams attached to the child process.
Expand Down
8 changes: 7 additions & 1 deletion vendor/boost_1.51/include/boost/process/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ struct context
*/
environment env;

/**
* Suppress creation of a console window on win32 (nop on other platforms)
*/
bool suppress_console;

/**
* Constructs a process context.
*
Expand All @@ -91,7 +96,8 @@ struct context
*/
context()
: 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 defined(BOOST_POSIX_API)
Expand Down
6 changes: 5 additions & 1 deletion vendor/boost_1.51/include/boost/process/operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ inline child create_child(const std::string &executable, Arguments args,
boost::shared_array<char> envstrs =
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)
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateProcess() failed");

Expand Down
3 changes: 2 additions & 1 deletion vendor/boost_1.51/include/boost/process/process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,12 @@ class process
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed");
return h;
}

protected:
/**
* The process handle.
*/
handle handle_;
private:
#endif
};

Expand Down

0 comments on commit 7b18403

Please sign in to comment.