<?xml version="1.0" standalone="yes"?>
<programlisting>
for (auto &amp; s : seq)
    s.<methodname alt="boost::process::v1::extend::handler::on_setup">on_setup</methodname>(*this);

if (<methodname alt="boost::process::v1::extend::windows_executor::error">error</methodname>())
{
    for (auto &amp; s : seq)
       s.<methodname alt="boost::process::v1::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::v1::extend::windows_executor::error">error</methodname>());
    return <classname alt="boost::process::v1::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::v1::child">child</classname> c(proc_info, exit_code);

if (<methodname alt="boost::process::v1::extend::windows_executor::error">error</methodname>())
    for (auto &amp; s : seq)
        s.<methodname alt="boost::process::v1::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::v1::extend::windows_executor::error">error</methodname>());
else
    for (auto &amp; s : seq)
        s.<methodname alt="boost::process::v1::extend::handler::on_error">on_success</methodname>(*this);

//now we check again, because an on_success handler might've errored.
if (<methodname alt="boost::process::v1::extend::windows_executor::error">error</methodname>())
{
    for (auto &amp; s : seq)
        s.<methodname alt="boost::process::v1::extend::handler::on_error">on_error</methodname>(*this, <methodname alt="boost::process::v1::extend::windows_executor::error">error</methodname>());
    return <classname alt="boost::process::v1::child">child</classname>();
}
else
    return c;

</programlisting>