30 Mayıs 2017 Salı

process

Giriş
Şu satırı dahil ederiz.
#include <boost/process.hpp>
aysnc_pipe Sınıfı
Constructor
Şöyle yaparız.
std::shared_ptr<boost::process::async_pipe> stdin_pipe = 
  std::make_shared<boost::process::async_pipe>(*io_service);
child Sınıfı
Constructor
Şöyle yaparız.
boost::iostreams::file_descriptor_sink sinkstdin = ...;
boost::iostreams::file_descriptor_source sourcestdin = ...;

std::unique_ptr<boost::process::child> p = 
std::unique_ptr<boost::process::child>(new boost::process::child(
  boost::process::execute(
    boost::process::initializers::set_args(args),
    boost::process::initializers::throw_on_error(),
    boost::process::initializers::bind_stdout(sinkstdout),
    boost::process::initializers::bind_stderr(sinkstderr),
    boost::process::initializers::bind_stdin(sourcestdin)
)));
wait metodu
Şöyle yaparız.
child.wait();
Free Style metodlar
create_pipe metodu
Şöyle yaparız.
// Create pipes for stdout, stderr
boost::process::pipe pstdout = boost::process::create_pipe();
boost::process::pipe pstderr = boost::process::create_pipe();
wait_for_exit
Şöyle yaparız.
std::unique_ptr<boost::process::child> p = ...;
if (boost::process::wait_for_exit(*p))
{...}





Hiç yorum yok:

Yorum Gönder