#pragma once #include #include namespace reproc { template std::pair run(const arguments &arguments, const options &options, Out &&out, Err &&err) { process process; std::error_code ec; ec = process.start(arguments, options); if (ec) { return { -1, ec }; } ec = drain(process, std::forward(out), std::forward(err)); if (ec) { return { -1, ec }; } return process.stop(options.stop); } inline std::pair run(const arguments &arguments, const options &options = {}) { struct options modified = options::clone(options); if (!options.redirect.discard && options.redirect.file == nullptr && options.redirect.path == nullptr) { modified.redirect.parent = true; } return run(arguments, modified, sink::null, sink::null); } }