tags:

views:

56

answers:

1

Hi all

I am creating a program and I'm doing the most possible asynchronously.

I need to run a program and when this program finishes it calls a callback function. I found a version of boost::process and decided to use, but it seems that there is the example but could not find the implementation in the source that I downloaded, could someone give me a hand?

code example http://www.highscore.de/boost/gsoc2010/process/user_guide.html#boost_process.user_guide.waiting and download source boost::process here www.highscore.de/cpp/process/

I need to create an implementation for it or there but I got the sources from the wrong place?

this is a sample code to resolve my problem.

boost::asio::io_service ioservice;

void end_wait(const boost::system::error_code &ec, int exit_code); 

int main() 
{ 
    std::string exe = boost::process::find_executable_in_path("hostname"); 
    std::vector<std::string> args; 
    boost::process::child c = boost::process::create_child(exe, args); 
    boost::process::status s(ioservice); 
    s.async_wait(c.get_id(), end_wait); 
    ioservice.run(); 
} 

void end_wait(const boost::system::error_code &ec, int exit_code) 
{ 
    if (!ec) 
    { 
#if defined(BOOST_POSIX_API) 
        if (WIFEXITED(exit_code)) 
            exit_code = WEXITSTATUS(exit_code); 
#endif 
        std::cout << "exit code: " << exit_code << std::endl; 
    } 
} 

Sorry my bad english Regards Bruno

A: 

Boost.Process is not an official Boost library. I can find no reference to the work in progress on this library on the author's blog later than this which is two years old.

I am not sure where is the "right place" to get the code given this uncertain prognosis. You could ask on the Boost forums - maybe there is a current/working test version in their repository that you can pick up.

Steve Townsend