process/doc/windows_pseudocode.xml
2016-12-03 02:11:09 +01:00

42 lines
1.8 KiB
XML

<?xml version="1.0" standalone="yes"?>
<programlisting>
for (auto &amp; s : seq)
s.<methodname alt="boost::process::extend::handler::on_setup">on_setup</methodname>(*this);
if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
{
for (auto &amp; s : seq)
s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
return <classname alt="boost::process::child">child</classname>();
}
int err_code = <ulink url="https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425.aspx">CreateProcess</ulink>(
exe,
cmd_line,
proc_attrs,
thread_attrs,
creation_flags,
env,
work_dir,
startup_info,
proc_info);
<classname alt="boost::process::child">child</classname> c(proc_info, exit_code);
if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
for (auto &amp; s : seq)
s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
else
for (auto &amp; s : seq)
s.<methodname alt="boost::process::extend::handler::on_error">on_success</methodname>(*this);
//now we check again, because a on_success handler might've errored.
if (<methodname alt="boost::process::extend::windows_executor::error">error</methodname>())
{
for (auto &amp; s : seq)
s.<methodname alt="boost::process::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::extend::windows_executor::error">error</methodname>());
return <classname alt="boost::process::child">child</classname>();
}
else
return c;
</programlisting>