[DEV] add v1.66.0

This commit is contained in:
2018-01-12 21:47:58 +01:00
parent 87059bb1af
commit a97e9ae7d4
49032 changed files with 7668950 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
# Copyright (c) 2006, 2007 Julio M. Merino Vidal
# Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
# Copyright (c) 2009 Boris Schaeling
# Copyright (c) 2010 Felipe Tanus, Boris Schaeling
# Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
project : requirements
<include>../../..
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<target-os>windows:<define>WIN32_LEAN_AND_MEAN
;
import testing ;
compile args.cpp ;
compile async_io.cpp ;
compile env.cpp ;
compile error_handling.cpp ;
compile io.cpp ;
compile posix.cpp : <build>no <target-os>linux:<build>yes ;
compile start_dir.cpp ;
compile sync_io.cpp ;
compile terminate.cpp ;
compile wait.cpp ;
compile windows.cpp : <build>no <target-os>windows:<build>yes ;

View File

@@ -0,0 +1,29 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <vector>
#include <string>
namespace bp = boost::process;
int main()
{
bp::child c("test.exe", "--foo", "/bar");
//or explicit
bp::child c2(
bp::exe="test.exe",
bp::args={"--foo", "/bar"}
);
c.wait();
c2.wait();
}

View File

@@ -0,0 +1,30 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/asio.hpp>
#include <boost/array.hpp>
#include <string>
namespace bp = boost::process;
int main()
{
boost::asio::io_context ios;
boost::asio::streambuf buffer;
bp::child c(
"test.exe",
bp::std_out > buffer,
ios
);
ios.run();
}

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
namespace bp = boost::process;
int main()
{
bp::environment my_env = boost::this_process::environment();
my_env["PATH"] += "/foo";
bp::system("test.exe", my_env);
bp::system("test.exe", bp::env["PATH"]+="/bar");
}

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <system_error>
namespace bp = boost::process;
int main()
{
std::error_code ec;
bp::child c1("test.exe", ec);
bp::child c2("test.exe", bp::ignore_error);
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//[intro
#include <boost/process.hpp>
using namespace boost::process;
int main()
{
ipstream pipe_stream;
child c("gcc --version", std_out > pipe_stream);
std::string line;
while (pipe_stream && std::getline(pipe_stream, line) && !line.empty())
std::cerr << line << std::endl;
c.wait();
}
//]

View File

@@ -0,0 +1,91 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <string>
namespace bp = boost::process;
int main()
{
//
bp::system(
"test.exe",
bp::std_out > stdout, //forward
bp::std_err.close(), //close
bp::std_in < bp::null //null in
);
boost::filesystem::path p = "input.txt";
bp::system(
"test.exe",
(bp::std_out & bp::std_err) > "output.txt", //redirect both to one file
bp::std_in < p //read input from file
);
{
bp::opstream p1;
bp::ipstream p2;
bp::system(
"test.exe",
bp::std_out > p2,
bp::std_in < p1
);
p1 << "my_text";
int i = 0;
p2 >> i;
}
{
boost::asio::io_context io_context;
bp::async_pipe p1(io_context);
bp::async_pipe p2(io_context);
bp::system(
"test.exe",
bp::std_out > p2,
bp::std_in < p1,
io_context,
bp::on_exit([&](int exit, const std::error_code& ec_in)
{
p1.async_close();
p2.async_close();
})
);
std::vector<char> in_buf;
std::string value = "my_string";
boost::asio::async_write(p1, boost::asio::buffer(value), []( const boost::system::error_code&, std::size_t){});
boost::asio::async_read (p2, boost::asio::buffer(in_buf), []( const boost::system::error_code&, std::size_t){});
}
{
boost::asio::io_context io_context;
std::vector<char> in_buf;
std::string value = "my_string";
bp::system(
"test.exe",
bp::std_out > bp::buffer(in_buf),
bp::std_in < bp::buffer(value)
);
}
{
boost::asio::io_context io_context;
std::future<std::vector<char>> in_buf;
std::future<void> write_fut;
std::string value = "my_string";
bp::system(
"test.exe",
bp::std_out > in_buf,
bp::std_in < bp::buffer(value) > write_fut
);
write_fut.get();
in_buf.get();
}
}

View File

@@ -0,0 +1,47 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/process/posix.hpp>
#include <boost/process/extend.hpp>
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <errno.h>
namespace bp = boost::process;
int main()
{
//duplicate our pipe descriptor into literal position 4
bp::pipe p;
bp::system("test", bp::posix::fd.bind(4, p.native_sink()));
//close file-descriptor from explicit integral value
bp::system("test", bp::posix::fd.close(STDIN_FILENO));
//close file-descriptors from explicit integral values
bp::system("test", bp::posix::fd.close({STDIN_FILENO, STDOUT_FILENO}));
//add custom handlers
const char *env[2] = { 0 };
env[0] = "LANG=de";
bp::system("test",
bp::extend::on_setup([env](auto &e) { e.env = const_cast<char**>(env); }),
bp::extend::on_fork_error([](auto&, const std::error_code & ec)
{ std::cerr << errno << std::endl; }),
bp::extend::on_exec_setup([](auto&)
{ ::chroot("/new/root/directory/"); }),
bp::extend::on_exec_error([](auto&, const std::error_code & ec)
{ std::ofstream ofs("log.txt"); if (ofs) ofs << errno; })
);
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/filesystem.hpp>
namespace bp = boost::process;
int main()
{
bp::system(
"test.exe",
bp::start_dir="../foo"
);
boost::filesystem::path exe = "test.exe";
bp::system(
boost::filesystem::absolute(exe),
bp::start_dir="../foo"
);
}

View File

@@ -0,0 +1,28 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <string>
namespace bp = boost::process;
int main()
{
bp::ipstream p;
bp::child c(
"test.exe",
bp::std_out > p
);
std::string s;
std::getline(p, s);
c.wait();
}

View File

@@ -0,0 +1,18 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
namespace bp = boost::process;
int main()
{
bp::child c("test.exe");
c.terminate();
}

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/asio.hpp>
namespace bp = boost::process;
int main()
{
{
bp::child c("test.exe");
c.wait();
auto exit_code = c.exit_code();
}
{
boost::asio::io_context io_context;
bp::child c(
"test.exe",
io_context,
bp::on_exit([&](int exit, const std::error_code& ec_in){})
);
io_context.run();
}
}

View File

@@ -0,0 +1,30 @@
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/process/windows.hpp>
#include <iostream>
#include <windows.h>
namespace bp = boost::process;
int main()
{
bp::system("test.exe",
bp::windows::show);
bp::system("test.exe",
bp::on_setup([](auto &e)
{ e.startup_info.dwFlags = STARTF_RUNFULLSCREEN; }),
bp::on_error([](auto&, const std::error_code & ec)
{ std::cerr << ec.message() << std::endl; })
);
}