| 1 | // g++ killer-test.cpp -I/usr/local/boost-1.64.0-gcc6.2-fPIC/include/ -L/usr/local/boost-1.64.0-gcc6.2-fPIC/lib -lboost_system
|
|---|
| 2 | // LD_LIBRARY_PATH=/usr/local/boost-1.64.0-gcc6.2-fPIC/lib ./killer-test
|
|---|
| 3 | #include <boost/process.hpp>
|
|---|
| 4 | namespace bp = boost::process;
|
|---|
| 5 | #include <boost/filesystem.hpp>
|
|---|
| 6 | namespace fs = boost::filesystem;
|
|---|
| 7 | #include <boost/asio.hpp>
|
|---|
| 8 | namespace asio = boost::asio;
|
|---|
| 9 |
|
|---|
| 10 | extern "C" {
|
|---|
| 11 | #include <sys/types.h>
|
|---|
| 12 | #include <signal.h>
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | int main(int argc, char **argv) {
|
|---|
| 16 | asio::io_service ios;
|
|---|
| 17 | bp::child c("./killer", std::to_string(SIGABRT));
|
|---|
| 18 | ios.run();
|
|---|
| 19 | c.wait();
|
|---|
| 20 |
|
|---|
| 21 | if ( EXIT_SUCCESS != c.exit_code() ) {
|
|---|
| 22 | return EXIT_FAILURE;
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | return EXIT_SUCCESS;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|