diff options
| author | Alexander Gluzsky <sss123next@list.ru> | 2013-02-03 12:54:02 +0000 |
|---|---|---|
| committer | Alexander Gluzsky <sss123next@list.ru> | 2013-02-03 12:54:02 +0000 |
| commit | 2637b7479c3e531f891346dbe84c73805a8b5e36 (patch) | |
| tree | bdfe96ed34c5f08b856fa760c2cdc70ba6763352 /plugins/New_GPG/src/include/libs/process/example | |
| parent | 32e17cfa965980f07e8321fb29d38d62a2e1ad27 (diff) | |
ability to change key password (because of fucked gpg which does not want to give us his stdin/stdout only via ugly windows console)
git-svn-id: http://svn.miranda-ng.org/main/trunk@3406 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src/include/libs/process/example')
17 files changed, 601 insertions, 0 deletions
diff --git a/plugins/New_GPG/src/include/libs/process/example/Jamfile.jam b/plugins/New_GPG/src/include/libs/process/example/Jamfile.jam new file mode 100644 index 0000000000..69b75bc527 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/Jamfile.jam @@ -0,0 +1,33 @@ +# 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>../../.. + <source>/boost//headers + <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 cleanup.cpp ; +compile cmd_line.cpp ; +compile env.cpp ; +compile error_handling.cpp ; +compile execute.cpp ; +compile intro.cpp ; +compile posix.cpp : <build>no <target-os>linux:<build>yes ; +compile streams.cpp ; +compile sync_io.cpp ; +compile terminate.cpp ; +compile wait.cpp ; +compile windows.cpp : <build>no <target-os>windows:<build>yes ; +compile work_dir.cpp ; diff --git a/plugins/New_GPG/src/include/libs/process/example/args.cpp b/plugins/New_GPG/src/include/libs/process/example/args.cpp new file mode 100644 index 0000000000..1d83cbf4c1 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/args.cpp @@ -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 <vector> +#include <string> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[args + std::vector<std::string> args; + args.push_back("test.exe"); + args.push_back("--foo"); + args.push_back("/bar"); + + execute(set_args(args)); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/async_io.cpp b/plugins/New_GPG/src/include/libs/process/example/async_io.cpp new file mode 100644 index 0000000000..5253886918 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/async_io.cpp @@ -0,0 +1,65 @@ +// 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/iostreams/device/file_descriptor.hpp> +#include <boost/asio.hpp> +#include <boost/array.hpp> +#include <string> +#if defined(BOOST_WINDOWS_API) +# include <Windows.h> +#endif + +using namespace boost::process; +using namespace boost::process::initializers; +using namespace boost::iostreams; + +boost::process::pipe create_async_pipe() +{ +#if defined(BOOST_WINDOWS_API) + std::string name = "\\\\.\\pipe\\boost_process_async_io"; + HANDLE handle1 = ::CreateNamedPipeA(name.c_str(), PIPE_ACCESS_INBOUND | + FILE_FLAG_OVERLAPPED, 0, 1, 8192, 8192, 0, NULL); + HANDLE handle2 = ::CreateFileA(name.c_str(), GENERIC_WRITE, 0, NULL, + OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); + return make_pipe(handle1, handle2); +#elif defined(BOOST_POSIX_API) + return create_pipe(); +#endif +} + +int main() +{ +//[async_io + boost::process::pipe p = create_async_pipe(); + + file_descriptor_sink sink(p.sink, close_handle); + execute( + run_exe("test.exe"), + bind_stdout(sink) + ); + + file_descriptor_source source(p.source, close_handle); + +#if defined(BOOST_WINDOWS_API) + typedef boost::asio::windows::stream_handle pipe_end; +#elif defined(BOOST_POSIX_API) + typedef boost::asio::posix::stream_descriptor pipe_end; +#endif + + boost::asio::io_service io_service; + pipe_end pend(io_service, p.source); + + boost::array<char, 4096> buffer; + boost::asio::async_read(pend, boost::asio::buffer(buffer), + [](const boost::system::error_code&, std::size_t){}); + + io_service.run(); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/cleanup.cpp b/plugins/New_GPG/src/include/libs/process/example/cleanup.cpp new file mode 100644 index 0000000000..6d40eee032 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/cleanup.cpp @@ -0,0 +1,37 @@ +// 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> +#if defined(BOOST_POSIX_API) +# include <signal.h> +#endif + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[cleanup + child c = execute(run_exe("test.exe")); + wait_for_exit(c); +//] + +//[cleanup_posix +#if defined(BOOST_POSIX_API) + signal(SIGCHLD, SIG_IGN); +#endif + execute(run_exe("test.exe")); +//] + +//[cleanup_windows + { + child c = execute(run_exe("test.exe")); + } +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/cmd_line.cpp b/plugins/New_GPG/src/include/libs/process/example/cmd_line.cpp new file mode 100644 index 0000000000..99b581ab7c --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/cmd_line.cpp @@ -0,0 +1,23 @@ +// 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> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[cmd_line + execute( + run_exe("test.exe"), + set_cmd_line("test --foo /bar") + ); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/env.cpp b/plugins/New_GPG/src/include/libs/process/example/env.cpp new file mode 100644 index 0000000000..d890af98fb --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/env.cpp @@ -0,0 +1,23 @@ +// 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> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[inherit_env + execute( + run_exe("test.exe"), + inherit_env() + ); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/error_handling.cpp b/plugins/New_GPG/src/include/libs/process/example/error_handling.cpp new file mode 100644 index 0000000000..4f7a261c33 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/error_handling.cpp @@ -0,0 +1,32 @@ +// 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/system/error_code.hpp> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[set_on_error + boost::system::error_code ec; + execute( + run_exe("test.exe"), + set_on_error(ec) + ); +//] + +//[throw_on_error + execute( + run_exe("test.exe"), + throw_on_error() + ); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/execute.cpp b/plugins/New_GPG/src/include/libs/process/example/execute.cpp new file mode 100644 index 0000000000..e8bd5947cc --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/execute.cpp @@ -0,0 +1,25 @@ +// 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> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[execute + execute(run_exe("test.exe")); +//] + +//[execute_path + boost::filesystem::path exe = "../test.exe"; + execute(run_exe(exe)); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/intro.cpp b/plugins/New_GPG/src/include/libs/process/example/intro.cpp new file mode 100644 index 0000000000..ce9b1a41da --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/intro.cpp @@ -0,0 +1,20 @@ +// 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; +using namespace boost::process::initializers; + +int main() +{ + execute(run_exe("test.exe")); +} +//] diff --git a/plugins/New_GPG/src/include/libs/process/example/posix.cpp b/plugins/New_GPG/src/include/libs/process/example/posix.cpp new file mode 100644 index 0000000000..21da84f4a9 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/posix.cpp @@ -0,0 +1,68 @@ +// 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/iostreams/device/file_descriptor.hpp> +#include <boost/assign/list_of.hpp> +#include <iostream> +#include <fstream> +#include <unistd.h> +#include <errno.h> + +using namespace boost::process; +using namespace boost::process::initializers; +using namespace boost::iostreams; + +int main() +{ +//[bind_fd + file_descriptor_sink sink("output.txt"); + execute( + run_exe("test"), + bind_fd(4, sink) + ); +//] + +//[close_fd + execute( + run_exe("test"), + close_fd(STDIN_FILENO) + ); +//] + +//[close_fds + execute( + run_exe("test"), + close_fds(boost::assign::list_of(STDIN_FILENO)(4)) + ); +//] + +//[close_fds_if + execute( + run_exe("test"), + close_fds_if([](int fd){ return fd == STDIN_FILENO; }) + ); +//] + +//[fork_execve + const char *env[2] = { 0 }; + env[0] = "LANG=de"; + execute( + run_exe("test"), + on_fork_setup([env](executor &e) + { e.env = const_cast<char**>(env); }), + on_fork_error([](executor&) + { std::cerr << errno << std::endl; }), + on_exec_setup([](executor&) + { chroot("/new/root/directory/"); }), + on_exec_error([](executor&) + { std::ofstream ofs("log.txt"); if (ofs) ofs << errno; }) + ); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/streams.cpp b/plugins/New_GPG/src/include/libs/process/example/streams.cpp new file mode 100644 index 0000000000..3319820055 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/streams.cpp @@ -0,0 +1,36 @@ +// 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/iostreams/device/file_descriptor.hpp> +#include <boost/assign/list_of.hpp> + +using namespace boost::process; +using namespace boost::process::initializers; +using namespace boost::iostreams; + +int main() +{ +//[stdout + file_descriptor_sink sink("stdout.txt"); + execute( + run_exe("test.exe"), + bind_stdout(sink) + ); +//] + +//[close_in_err + execute( + run_exe("test.exe"), + bind_stdout(sink), + close_stdin(), + close_stderr() + ); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/sync_io.cpp b/plugins/New_GPG/src/include/libs/process/example/sync_io.cpp new file mode 100644 index 0000000000..cc36c40d14 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/sync_io.cpp @@ -0,0 +1,35 @@ +// 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/iostreams/device/file_descriptor.hpp> +#include <boost/iostreams/stream.hpp> +#include <string> + +using namespace boost::process; +using namespace boost::process::initializers; +using namespace boost::iostreams; + +int main() +{ +//[sync_io + boost::process::pipe p = create_pipe(); + + file_descriptor_sink sink(p.sink, close_handle); + execute( + run_exe("test.exe"), + bind_stdout(sink) + ); + + file_descriptor_source source(p.source, close_handle); + stream<file_descriptor_source> is(source); + std::string s; + std::getline(is, s); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/terminate.cpp b/plugins/New_GPG/src/include/libs/process/example/terminate.cpp new file mode 100644 index 0000000000..7518e5cb80 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/terminate.cpp @@ -0,0 +1,21 @@ +// 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> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[terminate + child c = execute(run_exe("test.exe")); + terminate(c); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/wait.cpp b/plugins/New_GPG/src/include/libs/process/example/wait.cpp new file mode 100644 index 0000000000..c47edac0e3 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/wait.cpp @@ -0,0 +1,62 @@ +// 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> +#if defined(BOOST_WINDOWS_API) +# include <Windows.h> +#elif defined(BOOST_POSIX_API) +# include <sys/wait.h> +# include <errno.h> +#endif + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ + { +//[sync + child c = execute(run_exe("test.exe")); + auto exit_code = wait_for_exit(c); +//] + } + + { +//[async + boost::asio::io_service io_service; + +#if defined(BOOST_POSIX_API) + int status; + boost::asio::signal_set set(io_service, SIGCHLD); + set.async_wait( + [&status](const boost::system::error_code&, int) { ::wait(&status); } + ); +#endif + + child c = execute( + run_exe("test.exe") +#if defined(BOOST_POSIX_API) + , notify_io_service(io_service) +#endif + ); + +#if defined(BOOST_WINDOWS_API) + DWORD exit_code; + boost::asio::windows::object_handle handle(io_service, c.process_handle()); + handle.async_wait( + [&handle, &exit_code](const boost::system::error_code&) + { ::GetExitCodeProcess(handle.native(), &exit_code); } + ); +#endif + + io_service.run(); +//] + } +} diff --git a/plugins/New_GPG/src/include/libs/process/example/windows.cpp b/plugins/New_GPG/src/include/libs/process/example/windows.cpp new file mode 100644 index 0000000000..e2b2955b1e --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/windows.cpp @@ -0,0 +1,35 @@ +// 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 <iostream> +#include <Windows.h> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[show_window + execute( + run_exe("test.exe"), + show_window(SW_HIDE) + ); +//] + +//[create_process + execute( + run_exe("test.exe"), + on_CreateProcess_setup([](executor &e) + { e.startup_info.dwFlags = STARTF_RUNFULLSCREEN; }), + on_CreateProcess_error([](executor&) + { std::cerr << GetLastError() << std::endl; }) + ); +//] +} diff --git a/plugins/New_GPG/src/include/libs/process/example/windows_unicode.cpp b/plugins/New_GPG/src/include/libs/process/example/windows_unicode.cpp new file mode 100644 index 0000000000..1585cb2870 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/windows_unicode.cpp @@ -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) + +//[unicode +#define UNICODE +#include <boost/process.hpp> +#include <boost/filesystem.hpp> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ + boost::filesystem::path p = L"C:\\"; + execute( + run_exe(L"test.exe"), + set_cmd_line(L"test --help"), + start_in_dir(p) + ); +} +//] diff --git a/plugins/New_GPG/src/include/libs/process/example/work_dir.cpp b/plugins/New_GPG/src/include/libs/process/example/work_dir.cpp new file mode 100644 index 0000000000..cb17fd8d17 --- /dev/null +++ b/plugins/New_GPG/src/include/libs/process/example/work_dir.cpp @@ -0,0 +1,32 @@ +// 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> + +using namespace boost::process; +using namespace boost::process::initializers; + +int main() +{ +//[work_dir + execute( + run_exe("test.exe"), + start_in_dir("../foo") + ); +//] + +//[work_dir_abs + boost::filesystem::path exe = "test.exe"; + execute( + run_exe(boost::filesystem::absolute(exe)), + start_in_dir("../foo") + ); +//] +} |
