2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-20 16:52:14 +00:00

Compare commits

..

1042 Commits

Author SHA1 Message Date
Klemens Morgenstern
0ca663c826 Set ENOTSUP when PROC_PPID_ONLY is undefined
closes #452
2025-01-26 21:49:25 +08:00
Klemens Morgenstern
a2d2753aa8 zombie process fixes
closes #445, #447
2025-01-13 09:31:48 +08:00
Klemens Morgenstern
1b5272a9e1 changed cwd comparison to equivalent. 2025-01-13 08:36:36 +08:00
Jonas Greitemann
e842a060f1 implement move operations for process_io_binding and delete copy operations
This makes the test added in the previous commit pass.
2025-01-13 08:13:33 +08:00
Jonas Greitemann
4bb842564f add a (failing) test for process_stdio move semantics
This test currently fails on POSIX, as `process_io_binding` does not
explicitly implement move operations but holds on to a file descriptor
which exhibits reference semantics and has a non-trivial destructor.

The same test should pass on Windows as the Windows implementation makes
use of `unique_ptr` which gives it correct move semantics by virtue of
the rule of zero.
2025-01-13 08:13:33 +08:00
Jonas Greitemann
359820097b add test case for initializing process_stdio with complementary pipe ends
`process_stdio` holds on to the handles for `in`/`out`/`err`. In case of
pipes, `in` needs the handles of a `readable_pipe`, whereas `out` and
`err` need the handles of `writable_pipe`s. So far, the tests all create
a new pair using `connect_pipe`, pass the "correct" end into
`process_stdio`, and use the other end to interface with the process.

However, `process_io_binding` also supports construction from the
complementary pipe types, i.e., constructing `in`'s binding from a
`writable_pipe` and `out`/`err`'s bindings from `readable_pipe`s.
In this case, the constructor will create the corresponding pipe itself
and keep ownership of it. This mode was thus far not tested.
2025-01-13 08:13:33 +08:00
Klemens Morgenstern
b529769eb5 removed boost::system:: scope spec for error_code. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
d75ffb30ee windows link fixes. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
a6f2a1d005 windows fixes. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
e1c6a9b09b attempting to fix msvc build. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
9bd57d66b7 aded missing include to example/env.cpp 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
65251a2316 replace png with svg in install. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
298b60caca fixed for v2 namespace inlining. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
3fd8b2608c examples are compiled & included. 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
c33828a166 reference docs 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
2ccd97cd48 made v2 the default 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
7874a04958 switched to asciidoc 2024-12-20 20:53:29 +08:00
Klemens Morgenstern
b5eacaca51 disabled shell for android
Closes #440.
2024-12-20 10:09:54 +08:00
Klemens Morgenstern
2275057574 v2 uses PROC_THREAD_ATTRIBUTE_HANDLE_LIST for limiting fd
thanks @NVCherney for bring this to my attention.
2024-12-20 09:52:57 +08:00
Klemens Morgenstern
09a978d896 disabled gcc11 on freebsd 2024-12-20 09:50:51 +08:00
مهدي شينون (Mehdi Chinoune)
5cfdf3ec4c Fix building with CMake on MinGW-w64. (#439) 2024-12-20 09:49:55 +08:00
Alexander Grund
c0a23ae2c3 Fix Github Actions CI (#437)
* Fix Github Actions CI

Containerize old compiler jobs
Fix Node20 Glibc
Reformat job list to make it easier to update

* Fix install of packages

* Remove macos-12
2024-12-20 09:49:30 +08:00
tomy2105
64fc05c55d Add ability to auto link process library 2024-12-20 09:45:27 +08:00
Klemens Morgenstern
0f9dd52f02 added BOOST_PROCESS_V2_DISABLE_NOTIFY_FORK
See #430
2024-12-13 12:26:46 +08:00
Klemens Morgenstern
3fe2033062 fixes #431 2024-12-13 12:26:25 +08:00
Klemens Morgenstern
662c0b10e3 warning fixes
Closes #436, #437
2024-12-13 11:58:39 +08:00
Klemens Morgenstern
fa83c2f9ff fixes the exit-code error on osx builds. 2024-11-19 07:41:31 +08:00
Klemens Morgenstern
9925e82a5f fixed UB in limit_handles.
Closes #200.
2024-11-19 07:41:31 +08:00
Samuel Venable
7f03295c93 Solaris Fixes (#425)
* solaris fixes
2024-11-19 07:41:31 +08:00
Klemens Morgenstern
64c4cdac83 windows gcc compile fix 2024-11-13 08:26:07 +08:00
Klemens Morgenstern
58586e420c added deprecation notice for v1. 2024-10-30 09:05:20 +08:00
Samuel Venable
7e5dd4075f bp2::ext::env() Fixes (#415)
* Implement OpenBSD Executable PatH
* Static Cast Device and iNode
* Add Name Spaces to Exe Checker
* Strings to File System Paths

---------

Co-authored-by: freebsd <freebsd@freebsd.lan>
2024-10-30 09:05:20 +08:00
Samuel Venable
3ad68a3f2a [OpenBSD] Add Missing Semicolons (#414)
* [OpenBSD] Add Missing Semicolons
2024-10-30 09:05:20 +08:00
Samuel Venable
8a8ca8b7ab OpenBSD fix & Solaris fixes
[DragonFly BSD] Use Proper CWD From PID Code
2024-10-30 09:05:20 +08:00
Klemens Morgenstern
817128108a changed error macros to require a ; at the end. 2024-10-30 09:05:20 +08:00
Klemens Morgenstern
941e93b587 removed definition of NOMINMAX 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
e827d14542 reduced asio related macro usage. 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
f218a6a6c1 added pthread to test linking for freebsd on v1 as well. 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
11a0d0d7c1 added pthread to test linking for freebsd 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
fdfb5043cb add kvm to process target on bsd 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
e46a514629 replaced deadline_timer with steady_timer. 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
36954338d8 remove test_impl lib 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
a44fd24523 unified cancellation on process.async_wait() 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
eb6b49c090 disabled /boost//coroutine dependent tests 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
928674d2e3 added test async_wait cancellation test. 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
894f371898 typo fixes. 2024-10-30 08:09:28 +08:00
Klemens Morgenstern
7ed1648032 removed filesystem from the compiled lib.
Shuold fix #390.
2024-10-30 08:09:28 +08:00
Klemens Morgenstern
a96f7a04e0 Wrapped proc_info.h functions with IOS check. Using the ext functions will yield a operation_not_supported at runtime.
Closes #401.
2024-10-30 08:09:28 +08:00
Klemens Morgenstern
46b71d5e96 Switched #error to ENOTSUP for ext libs. Should help #413
Closes #358.
2024-10-30 08:09:28 +08:00
Klemens Morgenstern
9f104634a9 Typo fix.
Closes #365
2024-10-30 08:09:28 +08:00
Klemens Morgenstern
c492c93062 Added BOOST_PROCESS_V2_POSIX_FORCE_DISABLE_CLOSE_RANGE
Implements #378.
2024-10-30 08:09:27 +08:00
Klemens Morgenstern
12192d35d3 Applying @sehe's patch.
closes #317
2024-10-30 08:09:27 +08:00
Samuel Venable
f741b0d120 [DragonFly BSD] Use Proper CWD From PID Code 2024-10-30 08:09:27 +08:00
Brad Smith
211a3134b6 Fix building on OpenBSD
OpenBSD does not have close_range() nor does NetBSD.

OpenBSD needs environ like the other *BSD's.

The build was erroring on kp_pid, it looks like p_pid is appropriate.
2024-10-30 08:09:27 +08:00
Klemens Morgenstern
642bd7cf5c removed more faulty V2_DECLs 2024-10-30 08:09:27 +08:00
Julien Schueller
8df45b8f68 Fix undefined reference to ws2_32
else it fails to link on mingw:
```
process_handle_windows.o:process_handle_windows.cpp:(.text+0x25): undefined reference to `_imp__WSACleanup@0'
```
2024-10-30 08:09:27 +08:00
Benjamin Buch
54479a7372 remove dllimport from utf8.hpp to fix MSVC build 2024-10-30 08:09:27 +08:00
René Ferdinand Rivera Morell
9761be99bb Add support for modular build structure. (#389)
* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add requires-b2 check to top-level build file.

* Add missing test deps.

* Bump B2 require to 5.2

* Fix duplicate def of boost.process.fs feature.

* Add missing boost_test dependency.

* Move inter-lib dependencies to a project variable and into the build targets.

* Switch to /boost/test//included target for header only mode of Boost.Test.

* Adjust doc build to avoid boost-root references.

* Update build deps.

* Fix link and build of deps.
2024-10-30 08:09:27 +08:00
Klemens Morgenstern
e5e898f363 fixed v1 reference include. 2024-09-26 18:48:51 +08:00
Jackarain
9561ebad1c Fix mingw cross-compile 2024-07-31 08:19:56 +08:00
Klemens Morgenstern
755a3ec78d fixed dll symbokl export on windows & clean up jamfile. 2024-07-24 10:12:10 +08:00
Klemens Morgenstern
5f80218655 added CLOSE_RANGE_UNSHARE defined for syscall of close_range. 2024-07-20 08:25:10 +08:00
Ruben Perez
3719df39cd Alpine-Linux CI 2024-07-20 08:25:10 +08:00
Klemens Morgenstern
67a2f97633 fixes include of gnu/libc-version.h
closes #386
2024-07-19 09:17:06 +08:00
Klemens Morgenstern
8b3e90234b b2 link fixes. 2024-07-12 09:03:08 +08:00
Klemens Morgenstern
8044857bb9 c++14 constexpr fixes for environment_win. 2024-07-12 09:03:08 +08:00
zhixingchen
414d0d6b84 FIX: fix the function call with error code 2024-07-04 19:17:17 +08:00
Klemens Morgenstern
2c372461e8 added link to ntdll. 2024-07-03 18:18:02 +08:00
Klemens Morgenstern
2b436127ee added WinSock.h include workarounds. 2024-07-03 16:36:31 +08:00
Klemens Morgenstern
c342762484 added Boost::filesystem dependency to build scripts. 2024-07-03 10:32:49 +08:00
Klemens Morgenstern
c2da58e548 added exit_code timeout. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
aea22dbf6b added musl workaround. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
084a85fc6e switched to run_for in exit_code.cpp. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
2171367d97 added completion to spawn in tests. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
67a92df441 fixed missing return. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
c773ee16cf replaced v2 .ipp with lib. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
274fc3163a minor process_handle_fd.hpp fix. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
44cae64d49 minor fixes. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
55e2460967 moved v1 to v1 inline namespace. 2024-07-02 21:06:23 +08:00
Klemens Morgenstern
bcdd91188c move everything v1 to v1 folders 2024-07-02 21:06:23 +08:00
Daniel Klauer
e455a12e2c posix: Add test for pipe fd leak if redirecting both stdout and stderr
Signed-off-by: Daniel Klauer <daniel.klauer@gin.de>
2024-06-04 08:54:21 +08:00
Daniel Klauer
e8b5bf17f0 posix: Fix pipe fd leak if redirecting both stdout and stderr
This re-adds the close(source) call which already existed here before
commit caa7b2fcc8. pipe_out already closes the source fd when redirecting
stdout or stderr, it was just missing when redirecting both at once.

The pipe fds must be closed after redirecting to avoid keeping the pipe
open unnecessarily, for example the parent may want to close their end of
the pipe.

Closes: https://github.com/boostorg/process/issues/353
Signed-off-by: Daniel Klauer <daniel.klauer@gin.de>
2024-06-04 08:54:21 +08:00
Orgad Shaneh
20510abc65 Doc: Add missing ctor param in example 2024-06-04 08:20:11 +08:00
Daniel Klauer
0058a9c69f posix: Fix exec error reporting with limit_handles
_pipe_sink was assigned after call_on_setup(), after limit_fd_::on_setup(),
but this was too late. It must be assigned earlier so that
executor::get_used_handles() can see it and prevent limit_handles from
closing the internal pipe for passing exec() errors from child to parent.

Fixes: 1a1d677d
Closes: https://github.com/boostorg/process/issues/202
Signed-off-by: Daniel Klauer <daniel.klauer@gin.de>
2024-06-04 08:19:54 +08:00
zhixingchen
a26f4fe3c5 FIX: fix the posix terminate function implement. 2024-06-04 08:07:54 +08:00
zhixingchen
ff5b383833 FIX: fix the problem of sending the wrong signal. 2024-06-04 08:07:54 +08:00
Samuel Venable
0379ee6668 Less dependency on libprocstat and various corrections.
On FreeBSD I would like to remove dependency on libprocstat completely, and replace it with libkvm to be more like the other *BSD platforms in terms of linker dependencies. This pull request is our first move in that direction.

Replace libprocstat with libkvm in cmd
2024-06-04 08:04:03 +08:00
zhixingchen
193384a450 FIX(process): modify the internal logic call of resume without error code version. 2024-05-11 11:26:48 +08:00
Christian Eggers
406cd3ecf3 v2: sync initial value for exit code with v1
The initial value for the exit_code (0x7f) in v2 doesn't work with musl libc.
Here WIFSIGNALED(0x7f) expands to a non-zero value:

http://git.musl-libc.org/cgit/musl/tree/include/sys/wait.h#n54
2024-04-01 06:40:48 +08:00
Devon Morris
c6951ff773 fix call on moved variable in execute 2024-04-01 06:38:00 +08:00
mknaleczb
f2330c195a Changed return value from "" to string_type() 2024-04-01 06:36:48 +08:00
Samuel Venable
2ae279bd15 Add more error handling to bp2::ext cwd.ipp. (#354)
* Add more error handling to bp2::ext cwd.ipp.

* Remove redundant errno checks

these functions don't fail...
2024-04-01 06:35:17 +08:00
Christian Eggers
7a17af0f5c v2: fix closing of file descriptors
Fix off-by-one error. Currently, no handles are actually closed.
2024-03-28 21:57:13 +08:00
Christian Eggers
768944672f posix: pipe_out: fix merge conflict
In commit cbaa913e3d ("Merge branch 'develop' into limit_fd"), there
have been merge conflicts in two files. In pipe_out.hpp, a previous
commit from the "limit_fd" branch f8c0dd4da5 ("prototype for
limit_fd") had been eliminated during wrong conflict resolution.

The final result was, that file descriptors for stdout pipes were not
preserved when using limit_handles.

Example:

boost::asio::io_context io_context;
bp::async_pipe my_stdin(io_context);
bp::async_pipe my_stdout(io_context);
bp::child my_child("/usr/bin/echo", "Hello world",
    bp::std_in  < my_stdin,  // preserved by limit_handles
    bp::std_out > my_stdout, // closed by limit_handles
    bp::std_err > stderr,    // preserved by limit_handles
    bp::limit_handles)

Fixes: cbaa913e3d ("Merge branch 'develop' into limit_fd")
2024-03-28 21:56:58 +08:00
Klemens Morgenstern
46acb247f5 test include fix. 2024-03-28 11:05:33 +08:00
Klemens Morgenstern
08e3549713 #include vector fixes. 2024-03-28 08:30:08 +08:00
Klemens Morgenstern
029ad735fe added missing rename of variable. 2023-10-25 19:29:41 +08:00
Klemens Morgenstern
03a348ebdd Merge branch 'develop' of https://github.com/boostorg/process into develop 2023-10-25 19:06:26 +08:00
Klemens Morgenstern
f289f26c87 minor windows cleanup 2023-10-25 15:38:49 +08:00
Klemens Morgenstern
8d9aa1e31d incresed request_exit delay in windows process test. 2023-10-13 14:25:04 +08:00
Samuel Venable
1873f34435 Fix V2::EXT::CWD [SunOS] (#310)
* Fix V2::EXT::CWD [SunOS]

filesystem::canonical is basically the same thing as realpath on Unix-likes, which only resolves one symbolic link. If one symbolic link points to yet another symbolic link and so on and so forth, it will not resolve all symbolic links. It will only do one link for each call to canonical. On SunOS, unlike Linux, /proc/${pid}/cwd does not directly point to the literal current working directory of the given ${pid}. Instead, it will point to yet another symlink - /proc/${pid}/path/cwd which once you have followed that second link only then will you have the literal cwd path for the process id.
2023-10-12 21:43:59 +08:00
Ilia
5f795d9e62 Fix compilation for macOS 14 SDK
Fixes #342
2023-10-09 10:46:25 +08:00
Daniel Richard G
f17be678f2 fix group_wait test in cmake build. 2023-10-09 10:46:03 +08:00
AJIOB
b9fc531507 Code typos fix 2023-10-05 09:36:50 +08:00
Klemens Morgenstern
69c2c25729 added SIGTERM bit mask for freeBSD. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
8ab2332327 v2/env win test fix. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
ea69cda6d8 added can_interrupt check on windows to win tests. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
6b75b4039f increased timeout & added diagnostics. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
3c1beb40f6 windows move handle fix. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
e51970e3bb fixed windows interrupt & request_exit test. 2023-10-05 06:52:20 +08:00
Klemens
f3f8548dea allowing for SIGTERM in exit code on posix interrupts. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
4b7a00d4cf target: global timer workaround helper. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
c11f31d77e drone windows update. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
3769ec01f4 process native-exit code test. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
af47f4677c creation-flags fix. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
cf14d54343 pid no-access workarounds. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
b81cac8042 moved interrupt & request_exit into target. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
c92cce3652 cmd.ipp return fix. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
d270712fba link error fix. 2023-10-05 06:52:20 +08:00
Klemens Morgenstern
7b6b93691f fixed executor reset_cancellation_state.
Closes #338.
2023-10-05 06:52:20 +08:00
Shauren
507768e230 Fixed compile warning on msvc 2023-09-14 08:09:35 +08:00
SilverPlate3
502dc48753 Pass empty argument
closes #256
2023-08-14 17:47:17 +08:00
Ed Tanous
402acc151a Use boost::throw_exception
Using boost::throw_exception allows for modifications to these
exceptions on a per-application basis, including overriding with custom
implementations.

This also has the benefit of allowing compilation with -fno-exceptions
set, which should make this code more portable.
2023-08-14 17:41:37 +08:00
Roberto Rodriguez
0503b0997c Fix compilation with -Wall and -Werror 2023-08-14 17:41:00 +08:00
Klemens Morgenstern
8d372cb510 v2::environment link fixes 2023-08-14 17:28:54 +08:00
Klemens Morgenstern
bfb1ebb5bd Merge branch 'master' into develop
# Conflicts:
#	.github/workflows/ci.yml
#	include/boost/process/environment.hpp
#	include/boost/process/v2/exit_code.hpp
#	include/boost/process/v2/ext/cmd.hpp
#	include/boost/process/v2/ext/cwd.hpp
#	include/boost/process/v2/ext/env.hpp
#	include/boost/process/v2/ext/exe.hpp
#	test/v2/pid.cpp
#	test/v2/process.cpp
2023-06-28 20:30:30 +08:00
Klemens Morgenstern
c005adc8fc simplified stdio. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
5cab462710 added empty env var check to tests. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
ccd46dc692 added Bcrypt to gcc win builds. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
b3c8c3a8da fixed popen test. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
4dd6f28094 removed code_as_error. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
d73f228469 popen test adjustements. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
ccd1717588 test updates for CI 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
9a4aeab97e simplified terminate test. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
d66dce11bd ext/*.hpp order fix 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
fc38699a4b terminate test logs ec. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
a859c5151c removed posix-cmake-subdir from github actions. 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
8c2f403841 posix::basic_cmd handles empty cmd
closes #304.
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
6fb2702a79 fixed unsigned & signed warnings
closes #301
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
6cd4244f05 doc typo fixes 2023-06-28 20:24:12 +08:00
Klemens Morgenstern
0c42a58eac ~pipe_buf catches exceptions from overflow
Closes #111
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
f269236d38 vfork launcher fixes
closes #314
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
4b413d34f4 Remove initializer_list<wstring_view> constructors.
They are causing ambiguity and are not that useful.

Closes #313
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
1403af769b process uses v2::detail::throw_error
closes #318
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
964f6d3f7e pipe_* includes error_code
closes #316
2023-06-28 20:24:12 +08:00
Klemens Morgenstern
bccf42a3ec include fix for v2/environment.hpp. 2023-06-28 20:24:12 +08:00
nikola-sh
70c7ae694f Fix MSVC compile errors 2023-06-13 20:44:03 +08:00
Klemens Morgenstern
1fdd405a3f More typo fixes. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
af2e884352 Typo fixes. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
1fbd8bb5e1 handle_info include fix for handles.hpp. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
09ba5e8d47 Reduced amount of test & fixed path comparisons. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
2c6304b563 pid_test fixes for osx. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
e79c5f5edd Updated pid test. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
7a9ab79162 removed noexcept from env v2 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
0c1c6dfa90 sighchld service & test fixes. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
4f9f4c398a close #296. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
e4a3e305b4 ec use locations. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
9d51e1cd32 xproc fixes 2023-02-22 22:46:07 +08:00
Samuel Venable
f1302430cb extern process management. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
6f0d6a2e24 switched to BOOST_DEPRECATED. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
57b67e0173 added clang 3.8. noexcept deduction. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
bbc7eb82e5 disabled terminate test for freebsd. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
744e9d95b3 [drone] Removed mlocate dep. 2023-02-22 22:46:07 +08:00
Ivan Efimov
bc9a98787e Fix string construction in native_environment_impl::get 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
0fdd448c67 Deprecated wait_for & wait_until. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
5fcf5465ce Switched vector in list of sigclhd_service.
Closes #175
2023-02-22 22:46:07 +08:00
Gary Miguel
1dc9d8689e fix error message 2023-02-22 22:46:07 +08:00
Klemens
dc915be11d ec fix for search_path with std::filesystem.
closes #287.
2023-02-22 22:46:07 +08:00
Orgad Shaneh
d7df60938e Fix crash on search_path on Windows when PATHEXT is not found 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
765650aed3 Update process.cpp 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
f12bc25122 Disabled some tests for freebsd & added interrupt handling to osx test. 2023-02-22 22:46:07 +08:00
sdarwin
32a2c2297c Update metadata 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
3258e3a11c Typo fix. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
ba7e8db9bb Include fixes. 2023-02-22 22:46:07 +08:00
Klemens Morgenstern
3211afda4a More typo fixes. 2023-02-22 13:04:13 +08:00
Klemens Morgenstern
d3f006acd4 Typo fixes. 2023-02-22 13:01:46 +08:00
Klemens Morgenstern
99633a6e42 handle_info include fix for handles.hpp. 2023-02-22 12:26:31 +08:00
Klemens Morgenstern
1e614ee43e Reduced amount of test & fixed path comparisons. 2023-02-22 00:54:17 +08:00
Klemens Morgenstern
0e3358705d pid_test fixes for osx. 2023-02-21 16:27:40 +08:00
Klemens Morgenstern
27a35f452d Updated pid test. 2023-02-21 16:27:40 +08:00
Klemens Morgenstern
8fff7283ed removed noexcept from env v2 2023-02-21 16:27:40 +08:00
Klemens Morgenstern
611dac143f sighchld service & test fixes. 2023-02-20 14:09:38 +08:00
Klemens Morgenstern
8d93576b94 close #296. 2023-02-20 14:09:38 +08:00
Klemens Morgenstern
f703845011 ec use locations. 2023-02-20 14:09:38 +08:00
Klemens Morgenstern
abd052e09f xproc fixes 2023-02-20 14:09:38 +08:00
Samuel Venable
a3304564c6 extern process management. 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
5865c6b449 switched to BOOST_DEPRECATED. 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
4c872c0a0d added clang 3.8. noexcept deduction. 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
feabbee098 disabled terminate test for freebsd. 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
a5b6e70c39 [drone] Removed mlocate dep. 2023-02-20 14:09:37 +08:00
Ivan Efimov
347fc68476 Fix string construction in native_environment_impl::get 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
61ff12c8da Deprecated wait_for & wait_until. 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
bd8e81153c Switched vector in list of sigclhd_service.
Closes #175
2023-02-20 14:09:37 +08:00
Gary Miguel
5fde6bec9f fix error message 2023-02-20 14:09:37 +08:00
Klemens
cf64f7dc6a ec fix for search_path with std::filesystem.
closes #287.
2023-02-20 14:09:37 +08:00
Orgad Shaneh
8355c3e1b6 Fix crash on search_path on Windows when PATHEXT is not found 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
de797e388d Update process.cpp 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
fc33435f8b Disabled some tests for freebsd & added interrupt handling to osx test. 2023-02-20 14:09:37 +08:00
sdarwin
f45ec624db Update metadata 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
9682056278 Typo fix. 2023-02-20 14:09:37 +08:00
Klemens Morgenstern
a00115b454 Include fixes. 2023-02-20 14:09:37 +08:00
Sam Darwin
3db86ac69f Drone: update freebsd jobs (#274) 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
5ffb6bf8da using scope-exit limit group_wait. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
2c5a38bfbe Disabled limit_fd for freebsd. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
f28a6406ae group wait test on_scope exit fix. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
7a1820d546 Disabled pdfork by default, bc of asio errors. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
6bc5add9a7 Increased timeout for sporadically failing test. 2022-11-01 19:41:20 +08:00
Alexander Grund
f876ba81e6 Update .drone.star
Remove the `image` param which is superflous, misleading and may become an error. See https://github.com/boostorg/boost-ci/pull/189

[skip ci]
2022-11-01 19:41:20 +08:00
Klemens Morgenstern
e943f8fb9c Improved error message for OSX. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
bc55a93dce passing a pipe into sh test. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
2eee42d5e6 Added return_type to async_result<code_as_error_t> 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
2d2b124647 Minor bugfixes 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
50986cc330 Enabled freebsd build 2022-11-01 19:41:20 +08:00
Klemens
09f0a2c547 Fixed async_system. 2022-11-01 19:41:20 +08:00
Klemens
13af16bfec Added bind_launcher. 2022-11-01 19:41:20 +08:00
Klemens
7745fdc687 Added code_as_error completion handler. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
d36f481392 Added WIN32_LEAN_AND_MEAN to cmake 2022-11-01 19:41:20 +08:00
Klemens
011380c28a Shell(posix) fixes. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
ebd4e723c3 Exeuction support for shell. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
b8108c508f Implemented shell on windows. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
ecf3dde88c Windows bugfixes. 2022-11-01 19:41:20 +08:00
Klemens
4761b375d0 Added shell class. 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
ae6a9e6639 Closes #267 2022-11-01 19:41:20 +08:00
Klemens Morgenstern
2c35167d9b Closes #266 2022-11-01 19:41:20 +08:00
Klemens
b68900ca1c Fixed unsafe post-fork allocs for fd_whitelist. 2022-11-01 19:41:20 +08:00
Klemens
ba7fe11193 Added reaping child for execve error, closes #265. 2022-11-01 19:41:20 +08:00
grtowel1510f
b0da4ad10c fix issue #251 - fix simple shell command in posix
see issue #251 for description.
2022-11-01 19:41:20 +08:00
Klemens
c1b6eb4eb8 Merge branch 'develop' 2022-08-19 00:04:30 +08:00
Klemens
4ef1792b0a Typo fix. 2022-08-19 00:04:16 +08:00
Klemens
1a6956134a Merge branch 'develop' 2022-08-19 00:01:33 +08:00
Klemens Morgenstern
eb6bce0910 Merge pull request #264 from hebasto/220802-mingw
Fix compiling for MinGW-w64 using std::filesystem
2022-08-18 23:57:10 +08:00
Klemens
9a1c6991c9 Fixed cmake build 2022-08-18 22:02:33 +08:00
Klemens
352b6cf89f Added github action yml 2022-08-18 21:17:42 +08:00
Klemens
317b1b7c62 Added Boost::process to link_libraries in CMake. 2022-08-17 18:12:55 +08:00
Hennadii Stepanov
a7b65bfc44 Fix compiling for MinGW-w64 using std::filesystem 2022-08-02 09:36:44 +01:00
Klemens Morgenstern
ee945a6b95 Merge pull request #262 from boostorg/develop
Master update 1.80
2022-06-24 01:23:56 +08:00
Klemens Morgenstern
992de7b6ea Merge pull request #261 from boostorg/develop-merge
Master update 1.80
2022-06-23 10:30:01 +08:00
Klemens Morgenstern
6e597b5c8a Merge branch 'master' into develop-merge 2022-06-20 02:38:26 +08:00
Klemens
1a1d677d76 Closes #202 2022-06-11 15:00:32 +08:00
Klemens
c1fb7758b2 Added missing incldue 2022-06-11 13:25:27 +08:00
Klemens Morgenstern
e24af699cf Merge pull request #257 from boostorg/v2
V2
2022-06-11 13:15:49 +08:00
Klemens
e585864cf4 Changed default whitelist to stdio 2022-06-11 12:17:36 +08:00
Klemens
69a0615530 Fixed times in test 2022-06-10 22:04:01 +08:00
Klemens
26f4584e1e Increased wait time for group_wait 2022-06-10 19:52:41 +08:00
Klemens
43e845a691 Fixed execute_op error 2022-06-08 14:58:06 +08:00
Klemens
4d59330067 Added EINTR handling for OSX 2022-06-07 12:06:33 +08:00
Klemens
f59c1c180e Removed asserts around printf. 2022-06-07 11:38:03 +08:00
Klemens
618c931188 Added more additional diagnostics to test 2022-06-07 11:16:09 +08:00
Klemens
727881649c Typo fixes 2022-06-07 10:17:23 +08:00
Klemens
dd4bf8d857 Debugging env 2022-06-07 00:56:03 +08:00
Klemens
9d006cdd94 Improved environment tests to not drop other vars 2022-06-07 00:19:34 +08:00
Klemens
442a6ed8d8 Fixed fork_parent 2022-06-06 23:48:35 +08:00
Klemens
686945f46f Fixed signal completion. 2022-06-06 13:32:48 +08:00
Klemens
8979836f32 Added BOOST_TEST_IGNORE_SIGCHLD 2022-06-06 01:19:39 +08:00
Klemens
4dfc1bd4fd Fixed waitpid in the async_wait 2022-06-05 22:00:36 +08:00
Klemens
f90edf44e1 temporarily ignoring close_all_fds for diagnostics 2022-06-05 20:45:20 +08:00
Klemens
f56e42fd2e Added diagnostic for CI 2022-06-05 18:24:01 +08:00
Klemens
b9420be981 removed usin ""s 2022-06-05 17:47:37 +08:00
Klemens
548ea7d999 Process env test fixes 2022-06-05 16:54:52 +08:00
Klemens
f453d93e83 Set pth in env test to absolute 2022-06-05 16:09:24 +08:00
Klemens
693a33010d Added more logs to tests 2022-06-05 15:59:09 +08:00
Klemens
faad3fa4df More fixes 2022-06-05 15:36:04 +08:00
Klemens
4e2e580b4c Multiple non-linux fixes 2022-06-05 14:58:00 +08:00
Klemens
d60ea9c4d3 environ fix for apple 2022-06-05 02:39:41 +08:00
Klemens
a911da2c1f More CI-driven test fixes 2022-06-05 02:35:49 +08:00
Klemens
f0c98aa97f Multiple fixes 2022-06-05 02:11:24 +08:00
Klemens
062ac9beb2 Added limit_fd functionality 2022-06-05 01:55:28 +08:00
Klemens
fb48747fc8 Another cstring_ref 2022-06-04 23:26:14 +08:00
Klemens
f2a0367605 Minor buf fixes 2022-06-04 23:00:13 +08:00
Klemens
3163496b70 Added documentation 2022-06-04 21:19:40 +08:00
Klemens
4e64224ef1 Starlark fix & added alias for subdirector 2022-06-04 17:21:28 +08:00
Klemens
25669a78de Removed superfluous builds 2022-06-04 16:59:40 +08:00
Klemens
910192e2ad Added reference doc for v2. 2022-06-04 16:44:57 +08:00
Klemens
15984e3288 Enabled freebsd 2022-06-04 12:40:41 +08:00
Klemens
6aa704c208 Added comments 2022-06-04 12:35:20 +08:00
Klemens
62d40caddd Added sleep test. 2022-06-03 11:54:34 +08:00
Klemens
d63d502b40 Added v2 examples and some doc comments. 2022-06-03 11:03:30 +08:00
Klemens Morgenstern
3a401dd306 Merge pull request #253 from Flamefire/patch-1
Remove superflous calls in CMakeLists
2022-06-03 01:05:51 +08:00
Klemens
3893a96c6e Added hashs for environment. 2022-06-02 04:01:24 +08:00
Klemens
76c393fb8e Added execute & async_execute. 2022-06-01 16:07:38 +08:00
Klemens
4fce3c8184 Added popen. 2022-06-01 14:51:56 +08:00
Klemens
54b698dcbd Added special treatment for pipes in stdio. 2022-06-01 13:48:51 +08:00
Klemens
1f45677518 Added exit-code error category. 2022-06-01 12:43:57 +08:00
Klemens
1493e365ed FreeBSD fixes. 2022-05-31 13:24:36 +08:00
Klemens
5e5e0b8641 Minor doc additions. 2022-05-31 12:55:14 +08:00
Klemens Morgenstern
932ac3038e Added tests for windows extra launchers. 2022-05-31 10:29:39 +08:00
Klemens Morgenstern
00bc1ccf47 Fixed windows extra launchers. 2022-05-30 11:47:58 +08:00
Klemens
257da990d5 Added pidfd_open impl for linux. 2022-05-30 01:41:20 +08:00
Klemens Morgenstern
c6a812e401 Added test & fixed some found bugs. 2022-05-29 14:51:44 +08:00
Klemens Morgenstern
f93290d3d4 Completed windows port to v2 from asio. 2022-05-29 02:38:37 +08:00
Klemens
a46ab25046 Added utf8 on linux. 2022-05-26 16:58:20 +08:00
Klemens Morgenstern
1b61ba6ea7 Fixed InputIt overlaods. 2022-05-26 15:59:49 +08:00
Klemens Morgenstern
27f79e1774 Added missing files. 2022-05-26 15:54:21 +08:00
Klemens Morgenstern
0fbfa1cdc1 Switched to pure utf8 support on windows. 2022-05-26 15:01:01 +08:00
Alexander Grund
47c4496d05 Remove superflous calls in CMakeLists
The find_package is not required, as the dependencies are done using the superproject build
The include_directories is already there: target_include_directories
2022-05-23 16:12:28 +02:00
Klemens Morgenstern
c473251709 Added windows environment stuff. 2022-05-20 12:25:32 +08:00
Klemens
7bdf11f550 Added posix first environment draft. 2022-05-20 01:52:48 +08:00
Klemens
dbcc946dac Added early return for empty input. 2022-05-19 19:24:03 +08:00
Klemens
e0e801cbb4 Added the pid get_id function and pid_type type alias. 2022-05-19 19:24:03 +08:00
Klemens
4943c74e8e First steps for v2
- Added utility functions
 - cstring_ref
 - codecvt functions
2022-05-19 19:24:01 +08:00
Klemens
0733217423 Added boost_process_ prefix to test/CMakeFiles.txt. 2022-05-19 19:20:53 +08:00
Klemens
397e685053 Updated readme. 2022-05-19 17:20:36 +08:00
Klemens Morgenstern
610b337fa3 Drone & Multple fix (#250)
Squash after invalid branch & merge conflict.

* Fixed file_descriptor move assignment operator to return a reference to 'this'. Issue # 219

* Returning *this instead of erroneous *this. Issue # 219

* Removed unneeded WNOHANG.

* Closes boostorg/process#190

* Closes boostorg/process#121

* Attempting to fix wchar_t build error on circle.

* Closes boostorg/process#197.

* Changed child(pid_t) signature.

* Multiple fixes.

* Closes boostorg/process#189.

* Closes boostorg/process#191.

* Added missing work guard on windows.

* Trying to catch windows early complete.

* Increased log level on windows.

* Multiple windows test fixes

* Removed overly constraint tests.

* fix missing headers

* Closes klemens-morgenstern/boost-process#218

* Update executor.hpp

explicit cast to int to silence this: `error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]`

* Fix posix implementation of move constructor/assignment in file_descriptor

* Adjust docs `@boost` relative paths

* Fixed UB for large environment names.

* Closes boostorg/process#207.

* Drone setup

* Added include for filesystem::fstream.

* Disabled useless tests.

* Fixed environment length checks.

* Pipe test & warning fixes.

* Disabled warnings & added windows include fix.

* More test fixes.

* Removed some tests from apple build.

* Removed some tests from apple build.

* Disabled OSX tests via build script & fixed windows examples.

* TSA fix attempt.

Co-authored-by: James Baker <james.baker@bullochtech.com>
Co-authored-by: silent <silent@symica.com>
Co-authored-by: ikrijan <62850248+ikrijan@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Co-authored-by: alandefreitas <alandefreitas@gmail.com>
2022-05-19 17:00:15 +08:00
Klemens Morgenstern
bbb7dced5c Merge pull request #245 from hgkjshegfskef/develop
Fix missing include
2022-05-19 14:50:17 +08:00
ikrijan
ab82e78c3d Update executor.hpp
explicit cast to int to silence this: `error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]`
2022-05-18 21:15:44 +08:00
silent
a295cd8635 Closes klemens-morgenstern/boost-process#218 2022-05-18 21:15:44 +08:00
silent
b8bcfa2e11 fix missing headers 2022-05-18 21:15:44 +08:00
Klemens Morgenstern
ed659bf129 Removed overly constraint tests. 2022-05-18 21:15:44 +08:00
Klemens Morgenstern
4cadf1d333 Multiple windows test fixes 2022-05-18 21:15:44 +08:00
Klemens
220bec28bf Increased log level on windows. 2022-05-18 21:15:44 +08:00
Klemens
ee3c2cfeeb Trying to catch windows early complete. 2022-05-18 21:15:44 +08:00
Klemens
221550a848 Added missing work guard on windows. 2022-05-18 21:15:44 +08:00
Klemens
b7821ccf09 Closes boostorg/process#191. 2022-05-18 21:15:44 +08:00
Klemens
1f464b3eb5 Closes boostorg/process#189. 2022-05-18 21:15:44 +08:00
Klemens
5abb4f4a23 Multiple fixes. 2022-05-18 21:15:44 +08:00
Klemens
722bd31cdb Changed child(pid_t) signature. 2022-05-18 21:15:44 +08:00
Klemens
e358dc52a2 Closes boostorg/process#197. 2022-05-18 21:15:44 +08:00
Klemens
d54788a385 Attempting to fix wchar_t build error on circle. 2022-05-18 21:15:44 +08:00
Klemens
4a5d711c86 Closes boostorg/process#121 2022-05-18 21:15:44 +08:00
Klemens
d11e327ab0 Closes boostorg/process#190 2022-05-18 21:15:44 +08:00
Klemens
edaf70a7a7 Removed unneeded WNOHANG. 2022-05-18 21:15:44 +08:00
Klemens Morgenstern
dc8ba65c77 Merge pull request #249 from ikrijan/patch-1
Update executor.hpp
2022-05-13 23:49:56 +08:00
ikrijan
ea26c7b2bd Update executor.hpp
explicit cast to int to silence this: `error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]`
2022-05-13 16:50:25 +02:00
hgkjshegfskef
4d1c438d91 Fix missing include 2022-04-20 17:36:20 +02:00
Klemens Morgenstern
d231979a6c Merge pull request #233 from alandefreitas/boost_rel_paths
Adjust documentation relative paths
2021-12-31 21:50:06 +08:00
alandefreitas
a3e8600e40 Adjust docs @boost relative paths 2021-12-28 19:41:40 -03:00
Klemens Morgenstern
c1d0f1be76 Merge pull request #227 from x-santiaga-x/patch-1
Closes klemens-morgenstern/boost-process#218
2021-10-29 18:59:23 +08:00
Klemens Morgenstern
10c93d88a1 Merge pull request #228 from x-santiaga-x/patch-2
Fix missing headers
2021-10-29 18:55:03 +08:00
silent
5f80e72e9c Closes klemens-morgenstern/boost-process#218 2021-10-29 13:24:19 +03:00
silent
d26ef52519 fix missing headers 2021-10-29 12:18:20 +03:00
Klemens Morgenstern
f4d2c260d4 Merge pull request #231 from klemens-morgenstern/develop
Master update
2021-10-27 17:36:17 +08:00
Klemens Morgenstern
e32651a260 Removed overly constraint tests. 2021-10-27 12:23:18 +08:00
Klemens Morgenstern
71aa7d9c00 Merge commit 'ed3b066' into develop 2021-10-27 11:45:43 +08:00
Klemens Morgenstern
ed3b066da1 Multiple windows test fixes 2021-10-27 11:43:33 +08:00
Klemens
83380dad79 Increased log level on windows. 2021-10-26 23:53:02 +08:00
Klemens
5ad5e82577 Trying to catch windows early complete. 2021-10-22 19:42:53 +08:00
Klemens
3acc1a3fa8 Added missing work guard on windows. 2021-10-16 15:46:11 +08:00
Klemens
9bb088ed5d Closes boostorg/process#191. 2021-10-15 10:57:01 +08:00
Klemens
cd4ef692e1 Closes boostorg/process#189. 2021-10-15 10:54:38 +08:00
Klemens
268795f3c0 Multiple fixes. 2021-10-14 17:41:27 +08:00
Klemens
f8f9c2323c Changed child(pid_t) signature. 2021-10-14 15:36:07 +08:00
Klemens
0c3ded6636 Closes boostorg/process#197. 2021-10-14 15:36:07 +08:00
Klemens
20b328dbf1 Attempting to fix wchar_t build error on circle. 2021-10-14 14:48:23 +08:00
Klemens
a60203dac3 Closes boostorg/process#121 2021-10-14 14:48:23 +08:00
Klemens
6d08cb369e Closes boostorg/process#190 2021-10-14 14:28:07 +08:00
Klemens
8dc5ee22f5 Merge remote-tracking branch 'boostorg/develop' into develop 2021-10-14 14:20:27 +08:00
Klemens Morgenstern
f7053f31ec Merge pull request #194 from Shauren/fix-linux-file-descriptor-move
Fix posix implementation of move constructor/assignment in file_descriptor
2021-10-14 14:20:18 +08:00
Klemens
a13a60d428 Removed unneeded WNOHANG. 2021-10-14 14:19:32 +08:00
Klemens Morgenstern
fa2a522ef2 Merge pull request #220 from odhinnsrunes/file_descriptor_move_assign_fix
Fixed file_descriptor move assignment operator returns a reference to this.
2021-10-14 14:14:23 +08:00
Klemens Morgenstern
2b39b56efb Merge pull request #208 from jorj1988/extend_hpp_include_memory
Add include to extend.hpp for memory.
2021-10-09 16:23:38 +08:00
Klemens Morgenstern
5a283e5200 Merge pull request #218 from Val-test/develop
Fix child construction from pid_t (it takes reference to pid_t for no reason).
2021-10-09 16:23:26 +08:00
Klemens Morgenstern
3d5f449052 Merge pull request #223 from apolukhin/patch-1
Remove trailing whitespace
2021-10-09 16:22:13 +08:00
Antony Polukhin
aefb990a7a Remove triling whitespace 2021-10-03 10:30:10 +03:00
Valentyn Pavliuchenko
3d092498b2 Fix child construction from pid_t (it takes reference to pid_t for no reason). 2021-08-19 19:54:42 +03:00
Klemens Morgenstern
7d7476343a Merge pull request #215 from Eddie-cz/develop
Missing include added
2021-08-08 20:09:20 +08:00
Eddie-cz
e08374ed95 Update wchar_t.hpp 2021-08-02 10:49:42 +02:00
Klemens Morgenstern
155ebdcf1f Merge pull request #181 from orgads/patch-1
Fix cross-compile linux->mingw
2021-07-05 14:48:01 +08:00
Orgad Shaneh
a9925a5d6d Fix cross-compile linux->mingw
Headers are lower case.
2021-07-05 09:17:16 +03:00
Peter Dimov
741d3f4a07 Add CMakeLists.txt 2021-05-28 02:42:50 +03:00
Peter Dimov
f195243a81 Merge branch 'master' into develop 2021-05-28 02:40:12 +03:00
George Pimm
8c5ab02192 Add include to extend.hpp for memory.
extend.hpp uses std::shared_ptr as a member but does not include it
2021-04-14 13:52:46 +01:00
Shauren
b526ac7ce5 Fix posix implementation of move constructor/assignment in file_descriptor 2021-01-16 17:02:41 +01:00
Klemens Morgenstern
8222a57744 Merge pull request #192 from eldiener/develop
Add "cxxstd" json field. The "cxxstd" json field is being added to ea…
2020-12-17 17:35:23 +08:00
Edward Diener
aa3ae06ab7 Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries whose minumum C++ standard compilation level is C++11 on up. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2020-12-16 10:32:08 -05:00
Klemens Morgenstern
1b4d67170f Merge pull request #177 from giomasce-throwaway/develop
Fix typo in copyright headers.
2020-10-29 21:17:53 +04:00
Klemens Morgenstern
e3594034eb Merge pull request #179 from nre-ableton/nre/develop/posix-default-locale
Return default locale on POSIX systems
2020-10-29 21:17:34 +04:00
Klemens Morgenstern
ee983eba64 Merge pull request #171 from Shauren/fix-windows-h
Fix windows builds that don't include Windows.h
2020-10-29 21:17:05 +04:00
nre
0eb4685558 Return default locale on POSIX systems
The comment here is incorrect; an empty locale is not the correct
behavior here and will cause exceptions to be thrown in other code.
Instead a locale object with the default constructor should be
returned, not one created with an empty string. This is a known issue
which was originally reported here:

https://svn.boost.org/trac10/ticket/4688

The issue claims to have been fixed in 7bb19f9 (see also:
https://svn.boost.org/trac10/changeset/72855).

However, this only fixes the issue for FreeBSD and not other POSIX
platforms. This patch is based on the one originally submitted here:

https://svn.boost.org/trac10/attachment/ticket/4688/boost_filesystem.patch
2020-10-16 10:07:14 +02:00
Giovanni Mascellani
7cf1a3b8e6 Fix typo in copyright headers. 2020-10-09 15:49:45 +02:00
Klemens Morgenstern
c0a1a82361 Merge pull request #173 from alloutlife/issue_121
Adding bug fix to resolve issue #121
2020-09-22 01:46:03 +03:00
Alexey Kushnarev
532951902f Adding bug fix to resolve issue #121 2020-09-14 12:16:14 +03:00
Shauren
642c2d369f Use ::boost::winapi::DWORD_ instead of global DWORD 2020-09-03 13:21:36 +02:00
Shauren
d7a721ee0d Removed __kernel_entry usage from Nt* function typedefs, is is part of SAL annoations, not neccessary for proper signature 2020-09-03 13:21:02 +02:00
James Baker
baa8d3fe7c Returning *this instead of erroneous *this. Issue # 219 2020-08-28 12:43:16 -04:00
James Baker
42bdfb5545 Fixed file_descriptor move assignment operator to return a reference to 'this'. Issue # 219 2020-08-28 11:13:39 -04:00
Klemens Morgenstern
0f053c323e Merge pull request #167 from zaucy/move_assignment_return_value_fix
Added return *this in move assignment operator
2020-08-03 16:29:09 +07:00
Ezekiel Warren
036c9fc4d1 Added return *this in move assignment operator 2020-08-01 18:53:20 -07:00
Klemens Morgenstern
b2a96a3e13 Merge pull request #215 from klemens-morgenstern/develop
Develop merge
2020-06-28 23:25:58 +07:00
Klemens David Morgenstern
1dbb3626a9 Changed async system test to let the subprocess wait, to avoid a race condition 2020-06-28 22:06:07 +07:00
Klemens David Morgenstern
d79e1f2443 changed limit_fd test to use stdin 2020-06-28 16:29:07 +07:00
Klemens David Morgenstern
605dcd19d8 Removed faulty reinterpret cast from posix test 2020-06-28 15:09:58 +07:00
Klemens David Morgenstern
6b6a6fa61c Fixed limit_fd windows test the current broke if stdout and stderr were the same, as a CI system might do 2020-06-27 14:21:53 +07:00
Klemens David Morgenstern
295e2bdd9c Merge branch 'develop' of github.com:boostorg/process into develop 2020-06-27 12:55:04 +07:00
Klemens Morgenstern
dd1513846b Merge pull request #165 from chriskohlhoff/standard-executors-changes
Changes required to compile with new Asio executors model
2020-06-27 12:54:34 +07:00
Christopher Kohlhoff
7a94abfaf2 Use strand<> rather than legacy executor io_context::strand. 2020-06-24 19:52:52 +10:00
Christopher Kohlhoff
b55a09479c New name for polymorphic executor. Remove unused "old services" code. 2020-06-24 19:52:52 +10:00
Klemens David Morgenstern
5afb20760c Fixed exe-args style for windows 2020-05-21 18:48:04 +07:00
Klemens Morgenstern
eec87e1dd9 Update child_handle.hpp 2020-05-21 01:38:37 +07:00
Klemens Morgenstern
f250a33fb4 Switched to report.py script 2020-05-20 21:50:37 +07:00
Klemens David Morgenstern
570cf83a96 Merge branch 'develop' of github.com:boostorg/process into develop 2020-05-20 21:07:49 +07:00
Klemens David Morgenstern
d52d244f83 Closes boostorg/process#134 2020-05-20 21:00:50 +07:00
Klemens Morgenstern
04ab646f12 Merge pull request #136 from jonesmz/patch-10
Fix "comparison between signed and unsigned" warning
2020-05-20 20:51:31 +07:00
Klemens David Morgenstern
31c65b5442 Closes boostorg/process#127 2020-05-20 20:49:46 +07:00
Klemens Morgenstern
ebbb6d8b36 Merge pull request #126 from Martchus/fix-on_exit-example
Pass io_context in on_exit example
2020-05-20 20:44:42 +07:00
Klemens Morgenstern
b9c0140a26 Merge pull request #119 from licekto/double-closed-fd-fixed
Fix for double closed FD: https://github.com/boostorg/process/issues/105
2020-05-20 20:44:02 +07:00
Klemens Morgenstern
27f587a4be Merge pull request #137 from jonesmz/patch-11
Fix async_system_future.cpp:60:9: warning: variable ‘exit_code’ set but not used
2020-05-20 20:40:07 +07:00
Klemens Morgenstern
7f6061c956 Merge pull request #138 from jonesmz/patch-12
Fix "comparison between signed and unsigned" warning
2020-05-20 20:38:58 +07:00
Klemens David Morgenstern
2f32c95341 Closes boostorg/process#145 and boostorg/process#188 2020-05-20 20:33:55 +07:00
Klemens Morgenstern
a8029fc191 Merge pull request #140 from jonesmz/patch-14
Fix comparison between signed and unsigned integer expressions
2020-05-20 20:15:01 +07:00
Klemens Morgenstern
9f4bd9bce3 Merge pull request #139 from jonesmz/patch-13
Fix warning: unused variable ‘env’
2020-05-20 20:14:53 +07:00
Klemens Morgenstern
71f844c24f Merge pull request #149 from jonesmz/patch-22
file_in.hpp:29:17: warning: suggest braces around initialization of subobject
2020-05-20 20:09:30 +07:00
Klemens David Morgenstern
b0b6d67e6f Closes boostorg/process#144 2020-05-20 20:09:14 +07:00
Klemens David Morgenstern
3a2576a4d8 Merge branch 'develop' of github.com:boostorg/process into develop 2020-05-20 20:07:47 +07:00
Klemens Morgenstern
34eaa262dd Merge pull request #147 from jonesmz/patch-20
close_out.hpp:25:52: warning: suggest braces around initialization of subobject
2020-05-20 20:06:46 +07:00
Klemens Morgenstern
ce3b3d8f99 Merge pull request #148 from jonesmz/patch-21
null_in.hpp:28:17: warning: suggest braces around initialization of s…
2020-05-20 20:06:35 +07:00
Klemens Morgenstern
429f2ba95c Merge pull request #150 from jonesmz/patch-23
pipe_in.hpp:30:17: warning: suggest braces around initialization of subobject
2020-05-20 20:05:29 +07:00
Klemens Morgenstern
0c2e7387c8 Merge pull request #152 from Naios/msvcfix
[Build Fix] Workaround for a MSVC 14.1 and 14.2 compiler bug
2020-05-20 20:05:22 +07:00
Klemens Morgenstern
2a2ea4b92d Merge pull request #146 from jonesmz/patch-19
Fix example/intro.cpp includes
2020-05-20 20:01:47 +07:00
Klemens David Morgenstern
873ab2558d Closes boostorg/process#153 2020-05-20 19:58:23 +07:00
Klemens David Morgenstern
03571d4eaf Merge branch 'develop' of github.com:boostorg/process into develop 2020-05-20 19:44:42 +07:00
Klemens Morgenstern
46ab3ba9b8 Merge pull request #158 from acronce/develop
Add the lambda declarator needed to disambiguate the multiple return …
2020-05-20 19:39:24 +07:00
Allen Cronce
3aba1f6eb1 Add the lambda declarator needed to disambiguate the multiple return values from these lambda functions as a bool. Before this change the return of a "false" was interpreted as an int, but the second return is a bool. This caused the following compile error when accessing environment variables under Xcode 11.4.1: Return type 'bool' must match previous return type 'int' when lambda expression has unspecified explicit return type 2020-05-13 07:25:36 -07:00
Denis Blank
44771769fa Workaround for a MSVC 14.1 and 14.2 compiler bug
* boost\include\boost/process/child.hpp(35): error C2600:
    'boost::process::child::child': cannot define a compiler-generated
    special member function (must be declared in the class first)
* Introduced by 8541cae
* See boostorg/process#113
2020-03-23 22:35:59 +01:00
Michael Jones
8704416941 pipe_in.hpp:30:17: warning: suggest braces around initialization of subobject 2020-03-13 02:57:56 -05:00
Michael Jones
f48392399f file_in.hpp:29:17: warning: suggest braces around initialization of subobject 2020-03-13 02:57:11 -05:00
Michael Jones
80f81117aa null_in.hpp:28:17: warning: suggest braces around initialization of subobject 2020-03-13 02:56:28 -05:00
Michael Jones
9cff55215d close_out.hpp:25:52: warning: suggest braces around initialization of subobject 2020-03-13 02:55:35 -05:00
Michael Jones
2e4b3c2406 Fix example/intro.cpp includes 2020-03-13 02:26:10 -05:00
Michael Jones
b510b6a9d9 Fix comparison between signed and unsigned integer expressions 2020-03-13 01:22:01 -05:00
Michael Jones
046b96186f Fix warning: unused variable ‘env’ 2020-03-13 01:20:10 -05:00
Michael Jones
1df2e67bc4 Fix "comparison between signed and unsigned" warning 2020-03-13 01:18:11 -05:00
Michael Jones
6cf69e2797 Fix async_system_future.cpp:60:9: warning: variable ‘exit_code’ set but not used 2020-03-13 01:11:46 -05:00
Michael Jones
d3e4cbf3b3 Fix "comparison between signed and unsigned" warning 2020-03-13 01:03:31 -05:00
Martchus
e67e49c891 Pass io_context in on_exit example
The description already states that an io_context needs
to be passed. This change is adjusting the example accordingly.
2020-03-08 21:17:54 +01:00
Licek Tomáš
29a43b17e4 Fix for double closed FD: https://github.com/boostorg/process/issues/105 2020-02-04 10:22:11 +01:00
Klemens David Morgenstern
6d10c3a807 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2020-01-26 15:18:00 +07:00
Klemens Morgenstern
668579ed6f Merge pull request #110 from sorayuki/patch-1
Fix memory over-write in pipe.hpp
2020-01-26 15:17:27 +07:00
Klemens Morgenstern
8af828cd43 Merge pull request #73 from fkonvick/develop
Fix double quotes processing on Windows
2020-01-26 15:16:39 +07:00
Klemens Morgenstern
590cc10b42 Merge pull request #75 from brunom/patch-1
typo
2020-01-26 15:15:07 +07:00
Klemens Morgenstern
3bc11ce3ac Merge pull request #113 from jonesmz/patch-1
Use = default for default constructor
2020-01-26 15:14:52 +07:00
Klemens Morgenstern
603441ecc3 Merge pull request #114 from jonesmz/patch-2
Use static constexpr instead of const for compile-time constant variable
2020-01-26 15:14:32 +07:00
Klemens Morgenstern
612a953369 Merge pull request #115 from jonesmz/patch-3
Use move construction for struct start_dir
2020-01-26 15:13:15 +07:00
Klemens Morgenstern
1554773d39 Merge pull request #213 from dermojo/develop
Documentation fixes
2020-01-26 15:10:44 +07:00
Daniel Evers
dd003bf2b0 Correct some typos etc. 2020-01-05 17:33:59 +01:00
Klemens Morgenstern
0341e08297 Merge pull request #212 from klemens-morgenstern/develop
Master update
2019-12-29 04:37:11 +08:00
Klemens David Morgenstern
5853345715 trying to fix appveyor to upload to report.ci 2019-12-29 04:16:44 +08:00
Klemens David Morgenstern
41f8b1cf00 removed sigtimedwait for group_wait 2019-12-29 03:39:32 +08:00
Klemens David Morgenstern
56ae00c7a4 typo fix 2019-12-29 00:48:51 +08:00
Klemens David Morgenstern
f58882c956 small travis fixes, hopefully fixing the build 2019-12-29 00:42:21 +08:00
Klemens David Morgenstern
3f14ebc755 changed report script 2019-12-29 00:04:26 +08:00
Michael Jones
1502de1001 Use move construction for struct start_dir 2019-12-05 17:48:17 -06:00
Michael Jones
8541cae396 Update child_decl.hpp 2019-12-05 12:59:09 -06:00
Michael Jones
38fa1fd040 Update cmd.hpp 2019-12-05 12:54:35 -06:00
Michael Jones
ba15f760ab Use static constexpr instead of const for compile-time constant variable 2019-12-05 12:53:06 -06:00
Michael Jones
5e3e8f977e Update error.hpp 2019-12-05 12:49:56 -06:00
Michael Jones
6182876d4f Update io.hpp 2019-12-05 12:44:14 -06:00
Michael Jones
5bfd2ee08c Use = default for default constructor 2019-12-05 12:41:31 -06:00
sorayuki
c91b227c47 Fix memory over-write in pipe.hpp 2019-11-25 15:31:48 +08:00
Klemens David Morgenstern
6a4d2ff721 added typedef executor_type; 2019-11-22 14:03:22 +08:00
Klemens David Morgenstern
6bf37ea8e8 Merge branch 'develop' of github.com:boostorg/process into develop
# Conflicts:
#	test/async_pipe.cpp
2019-11-22 13:11:17 +08:00
Klemens Morgenstern
ad38cdfada Merge pull request #106 from treesoft-de/bugfix
fix double CloseHandle after move of file_descriptor on windows
2019-11-22 13:08:17 +08:00
Klemens Morgenstern
167ee79fa9 Merge pull request #102 from res2k/develop
Miscellaneous fixes related to POSIX environments
2019-11-22 13:07:52 +08:00
Klemens David Morgenstern
6b83d0b9dd closes boostorg/process#97 2019-11-22 13:07:08 +08:00
Klemens Morgenstern
16d16d40be Merge pull request #90 from BikingGlobetrotter/develop
fixed hidden local variable
2019-11-22 13:06:12 +08:00
Klemens David Morgenstern
f5f0866745 closes boostorg/process#103 2019-11-22 13:04:59 +08:00
Klemens Morgenstern
408cff1997 Merge pull request #70 from thomassuckow/patch-1
Guard against EINTR in basic_pipe
2019-11-22 13:01:52 +08:00
Klemens David Morgenstern
09faec4732 closes boostorg/process#104 2019-11-22 12:59:05 +08:00
Klemens Morgenstern
5ab43529b7 Merge pull request #209 from killerbot242/changes3
only carry out when buffer size is > 0
2019-11-22 12:52:41 +08:00
Klemens Morgenstern
97f5b3c049 Merge pull request #211 from Instand/patch
Fix basic_ipstream is_open compile error.
2019-11-22 12:51:58 +08:00
Klemens David Morgenstern
6dd3e0bdb4 typo fix, closes klemens-morgenstern/boost-process#210 2019-11-22 12:50:40 +08:00
Arew
eba5cb7be2 Fix basic_ipstream is_open compile error. 2019-11-21 17:57:24 +03:00
Klemens David Morgenstern
f4c51bcd5a closes klemens-morgenstern/boost-process#107 2019-10-26 11:04:42 +07:00
Raymond Häb
410c0d592e fix double CloseHandle after move of file_descriptor on windows 2019-10-18 10:08:21 +02:00
Frank Richter
40df7899b2 test: Add test for direct conversion of wnative_environment to native_environment 2019-09-11 11:31:19 +02:00
Frank Richter
51083a8fa8 posix environment: Fix assignment of wnative_environment to wenvironment
Using 'environ' as the native_handle for a wide environment doesn't work,
as environ returns char**. Instead, use data we already converted.
2019-09-11 11:23:36 +02:00
Frank Richter
fe3cb0efc7 posix environment: Avoid using front() on empty string
That is undefined behaviour. Pushing a single NUL makes the string
non-empty but still gives us "".
2019-09-11 11:20:24 +02:00
Frank Richter
e0dd3b9658 test: Build fix for async_pipe 2019-09-11 11:01:45 +02:00
Lieven de Cock
d7d84f3952 only carry out when buffer size is > 0 2019-08-19 12:11:34 +02:00
Klemens Morgenstern
6ccce9104a Merge pull request #91 from orgads/patch-1
Fix GCC9 warning
2019-06-26 20:30:18 +10:00
Orgad Shaneh
984c0c5b71 Fix GCC9 warning
warning: moving a local object in a return statement prevents copy elision
2019-06-26 13:11:49 +03:00
michael
43523fcf8b fixed hidden local variable 2019-06-21 13:39:54 +02:00
Klemens Morgenstern
cf7ad36438 Merge pull request #87 from OBorce/feature/fix-stream-move-assignments
fix move assignment operators for basic_[io]pstream
2019-06-06 11:30:33 +07:00
boris
ca994c1972 fix move assignment operators for basic_[io]pstream 2019-06-05 00:19:53 +02:00
Klemens David Morgenstern
0a554c92b5 Merge branch 'develop' of github.com:boostorg/process into develop 2019-05-18 11:11:20 +07:00
Klemens Morgenstern
fa81cecffc Merge pull request #196 from klemens-morgenstern/limit_fd
Limit fd
2019-05-18 11:07:55 +07:00
Klemens David Morgenstern
977b76f6aa Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2019-05-15 12:31:16 +07:00
Klemens Morgenstern
fc1acb82d9 Merge pull request #199 from klemens-morgenstern/stream_close
added opstream::close, closes klemens-morgenstern/boost-process#198
2019-05-14 22:04:21 +07:00
Klemens David Morgenstern
db7af9f87d doc addition 2019-05-14 13:22:05 +07:00
Klemens Morgenstern
a350cc346b Merge pull request #203 from klemens-morgenstern/win_pipe_unlimited_instances
Closes boostorg/process#84 and boostorg/process#83
2019-05-14 12:41:29 +07:00
Klemens David Morgenstern
9fa86d3d65 removed call to 'close_sink' 2019-05-14 12:15:57 +07:00
Klemens David Morgenstern
e426f2bfac remove ill-formed test & minor fixes 2019-05-14 11:57:20 +07:00
Klemens David Morgenstern
6b173117aa Merge branch 'develop' into stream_close 2019-05-14 10:45:53 +07:00
Klemens David Morgenstern
ecbc93408f Merge branch 'develop' into win_pipe_unlimited_instances 2019-05-14 10:45:16 +07:00
Klemens David Morgenstern
6ba9a48d15 Merge branch 'develop' into new_wait_for_test 2019-05-14 10:44:40 +07:00
Klemens David Morgenstern
519c0a636a Merge branch 'develop' into limit_fd 2019-05-14 10:44:08 +07:00
Klemens David Morgenstern
82195c61af Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop
# Conflicts:
#	include/boost/process/detail/posix/wait_group.hpp
2019-05-14 00:41:41 +07:00
Klemens David Morgenstern
c604e3a20e switched to a wait/sleep version for OSX - should work fine for groups 2019-05-14 00:36:24 +07:00
Klemens Morgenstern
b27d0170ba Typo fix 2019-05-13 23:50:31 +07:00
Klemens David Morgenstern
98fd4eecf0 small reordering of code 2019-05-13 20:43:03 +07:00
Klemens David Morgenstern
3799315ce7 reverted to pipes for OSX 2019-05-13 20:11:17 +07:00
Klemens David Morgenstern
b9431ba492 fixing signal workaround 2019-05-13 10:30:28 +07:00
Klemens David Morgenstern
c0dca35615 added wrongfully removed build script options 2019-05-13 00:28:10 +07:00
Klemens David Morgenstern
790d79db9c Merge branch 'develop' into limit_fd 2019-05-13 00:23:52 +07:00
Klemens David Morgenstern
5de0a795d1 fixed wait_for_exit 2019-05-13 00:22:46 +07:00
Klemens David Morgenstern
cbaa913e3d Merge branch 'develop' into limit_fd
# Conflicts:
#	include/boost/process/detail/posix/pipe_out.hpp
#	test/Jamfile.jam
2019-05-12 17:43:40 +07:00
Klemens David Morgenstern
5786162fb5 Merge branch 'develop' into new_wait_for_test 2019-05-12 17:42:08 +07:00
Klemens David Morgenstern
78c44dd560 Merge branch 'develop' into win_pipe_unlimited_instances 2019-05-12 17:40:54 +07:00
Klemens David Morgenstern
23ff67d83d added space for pipe close test 2019-05-12 17:37:35 +07:00
Klemens David Morgenstern
476c6ccd95 Merge branch 'develop' into stream_close 2019-05-12 17:13:36 +07:00
Klemens David Morgenstern
28126b3432 osx fix 2019-05-12 17:02:25 +07:00
Klemens David Morgenstern
ed8388d091 actual fix 2019-05-12 16:55:45 +07:00
Klemens David Morgenstern
43c402a5da test logic fix 2019-05-12 16:53:54 +07:00
Klemens David Morgenstern
9ff2f6f3ef still trying for circleci 2019-05-10 16:56:11 +07:00
Klemens David Morgenstern
b2a0fadaca Merge branch 'develop' into new_wait_for_test
# Conflicts:
#	.travis.yml
2019-05-10 16:38:23 +07:00
Klemens David Morgenstern
3c4057204e hopefully fixed wait_for for osx 2019-05-10 16:34:51 +07:00
Klemens David Morgenstern
717ac47510 further investigation of circlci error 2019-05-10 12:21:37 +07:00
Klemens David Morgenstern
4f6f4eb391 updated for circle 2019-05-10 12:00:43 +07:00
Klemens David Morgenstern
99e04036c7 removed report-ci from circle-ci 2019-05-10 00:37:00 +07:00
Klemens David Morgenstern
519e339365 added more checks 2019-05-09 23:05:09 +07:00
Klemens David Morgenstern
d2c930470f removed && false 2019-05-09 17:08:58 +07:00
Klemens David Morgenstern
d5709ae747 trying to fix wait_for 2019-05-09 16:35:58 +07:00
Klemens David Morgenstern
d2ab81b1b9 Merge branch 'develop' into new_wait_for_test
# Conflicts:
#	include/boost/process/detail/posix/wait_for_exit.hpp
#	include/boost/process/detail/posix/wait_group.hpp
2019-05-09 12:20:20 +07:00
Klemens David Morgenstern
885557fe01 still trying to make wait_for work 2019-05-09 12:19:26 +07:00
Klemens David Morgenstern
b5b758f89a Merge branch 'develop' into stream_close 2019-05-09 11:29:31 +07:00
Klemens David Morgenstern
2a954eb809 Merge branch 'develop' into win_pipe_unlimited_instances 2019-05-09 11:24:14 +07:00
Klemens David Morgenstern
0edff5449a Merge branch 'develop' into new_wait_for_test
# Conflicts:
#	include/boost/process/detail/posix/wait_for_exit.hpp
2019-05-08 16:53:45 +07:00
Klemens David Morgenstern
417ea77f2f changed SIGTERM to SIGKILL 2019-05-08 16:50:49 +07:00
Klemens David Morgenstern
9e3fdc9669 SIGSEV fix 2019-05-08 16:44:38 +07:00
Klemens David Morgenstern
66c2867371 removed travis token 2019-05-08 16:30:39 +07:00
Klemens David Morgenstern
caa7b2fcc8 two minor fixes 2019-05-08 16:28:54 +07:00
Klemens David Morgenstern
6263e74bcd Merge branch 'develop' into limit_fd 2019-05-07 12:16:53 +07:00
Klemens David Morgenstern
faae08ee64 replaced 1 with ::boost::winapi::HANDLE_FLAG_INHERIT_ 2019-05-07 12:16:32 +07:00
Klemens David Morgenstern
2314e19f12 restructured osx wait
Check if it solves klemens-morgenstern/boost-process#200
2019-05-07 12:01:04 +07:00
Klemens David Morgenstern
cfd0fc055c fixed overflow func 2019-05-07 11:48:16 +07:00
Klemens David Morgenstern
849b5d0f30 Closes boostorg/process#84 and boostorg/process#83 2019-05-07 10:59:50 +07:00
Klemens Morgenstern
d13df2a194 Merge pull request #82 from Parean/develop
should close klemens-morgenstern/boost-process#201
2019-05-03 21:07:53 +07:00
Denis Smirnov
86fc3b0b4d should close klemens-morgenstern/boost-process#201 2019-05-03 19:07:17 +07:00
Klemens David Morgenstern
4733ca719f typo fix 2019-04-25 22:40:13 +07:00
Klemens David Morgenstern
296f12eb64 RAII issues & resetting flags on windwos handles 2019-04-25 22:36:30 +07:00
Klemens David Morgenstern
96d3470e37 added this-> before clear() 2019-04-25 22:06:23 +07:00
Klemens David Morgenstern
2265c98d81 added missing ; 2019-04-25 20:24:42 +07:00
Klemens David Morgenstern
060e5c2526 fixed name lookup 2019-04-25 15:15:29 +07:00
Klemens David Morgenstern
b4894807f1 added opstream::close, closes klemens-morgenstern/boost-process#198 2019-04-24 18:24:44 +07:00
Klemens David Morgenstern
2aa5e1461c Merge branch 'develop' into new_wait_for_test
# Conflicts:
#	test/Jamfile.jam
2019-04-20 16:41:31 +08:00
Klemens Morgenstern
61fa15fa48 Merge pull request #197 from toonetown/fix-wait_for-fork-macOS
Use SIGTERM instead of `-15`.
2019-04-20 15:39:54 +07:00
Nathan Toone
92508e06a1 Use SIGTERM instead of -15. 2019-04-19 23:44:54 -06:00
Klemens David Morgenstern
e85f0d0816 Closes klemens-morgenstern/boost-process#139 2019-04-10 12:18:02 +08:00
Klemens David Morgenstern
5e90c8de9b fixed up tests 2019-04-10 10:09:32 +08:00
Klemens David Morgenstern
a486a25a07 appveyor minor fix, pipe_out naming fix & limit_fd small sanity check because of weird osx bug 2019-04-10 01:33:21 +08:00
Klemens David Morgenstern
f8c0dd4da5 prototype for limit_fd 2019-04-09 23:39:43 +08:00
Klemens David Morgenstern
ee6870bfbc added used_handles & limit_fd for windows 2019-04-09 19:16:55 +08:00
Klemens David Morgenstern
0422b6bfb8 added posix get_handle function 2019-04-09 15:40:26 +08:00
Klemens David Morgenstern
7fc41b2815 added windows handles functionality 2019-04-09 14:31:50 +08:00
Klemens David Morgenstern
a49f1f6e2d Started on limit-fd functionality 2019-04-08 11:11:55 +08:00
Klemens David Morgenstern
af54484bc2 sed typo fix 2019-04-07 21:40:28 +08:00
Klemens David Morgenstern
ebcb30e4bd reduced amount of threads for build 2019-04-07 13:31:46 +08:00
Klemens David Morgenstern
5371c9813b typo fix 2019-04-07 13:07:11 +08:00
Klemens David Morgenstern
9a833c610d trying to fix the exit code 2019-04-07 12:53:02 +08:00
Klemens David Morgenstern
c99ebfee7a flipping typos 2019-04-07 12:34:37 +08:00
Klemens David Morgenstern
34861366e0 added sed for annotations 2019-04-07 12:19:17 +08:00
Klemens David Morgenstern
e6722c452c faulty log name fix (attempt) 2019-04-07 11:47:18 +08:00
Klemens David Morgenstern
b1e38842fb renamed the no-valgrind log 2019-04-07 03:15:38 +08:00
Klemens David Morgenstern
bcc9826e67 still doing the ci thing here 2019-04-07 03:09:17 +08:00
Klemens David Morgenstern
b6c6753b87 added valgrind to circle Ci 2019-04-07 02:57:14 +08:00
Klemens David Morgenstern
0d008a88fc dammit circle 2019-04-07 02:49:14 +08:00
Klemens David Morgenstern
f92ec53968 circle ci example job fix 2019-04-07 02:36:14 +08:00
Klemens David Morgenstern
00a87d0a67 report-ci update for circleci 2019-04-07 02:29:52 +08:00
Klemens David Morgenstern
462334639c typo fix 2019-04-07 02:08:31 +08:00
Klemens David Morgenstern
7129182044 ci fixes - the similtaneous wait doen't work on osx 2019-04-07 02:03:08 +08:00
Klemens David Morgenstern
03fbed44ad typo fix 2019-04-07 01:23:10 +08:00
Klemens David Morgenstern
0277c4fcec CI fixes 2019-04-07 01:19:19 +08:00
Klemens David Morgenstern
4bc1ae6ff8 added async fix & fixed dangling develop workaroudn for async_pipe copy 2019-04-07 00:21:27 +08:00
Klemens David Morgenstern
266c4503aa Merge branch 'develop' into asio_no_deprecated 2019-04-06 23:58:47 +08:00
Klemens David Morgenstern
80479b6b70 removed errornous global variable 2019-04-06 23:58:27 +08:00
Klemens David Morgenstern
823a346a08 added another exit_code test 2019-04-06 23:53:11 +08:00
Klemens David Morgenstern
8f3a7b9c63 Merge branch 'develop' into asio_no_deprecated 2019-04-06 22:35:45 +08:00
Klemens David Morgenstern
2ebcc07892 Merge branch 'circleci' into develop 2019-04-06 22:33:22 +08:00
Klemens Morgenstern
a673cd9643 Update config.yml 2019-04-06 22:25:52 +08:00
Klemens Morgenstern
12971db132 Update config.yml 2019-04-06 22:19:11 +08:00
Klemens Morgenstern
94be279992 Update config.yml 2019-04-06 22:15:38 +08:00
Klemens David Morgenstern
12cded5995 switched test to strand 2019-04-06 22:15:12 +08:00
Klemens David Morgenstern
0c16a0e5b3 set params back to support report.ci 2019-04-06 22:11:04 +08:00
Klemens Morgenstern
e4a6fde7b9 Update config.yml 2019-04-06 18:28:40 +08:00
Klemens David Morgenstern
92d2bebaaf added test and fixed #189 and #157 as well as #93 2019-04-06 18:25:08 +08:00
Klemens David Morgenstern
7e7a8cbc1d fixed #194 2019-04-06 17:29:52 +08:00
Klemens Morgenstern
4f767f4bfe Update config.yml 2019-04-06 17:25:03 +08:00
Klemens Morgenstern
63f714ae2f Update config.yml 2019-04-06 16:54:07 +08:00
Klemens Morgenstern
1b3b9b707c Update config.yml 2019-04-06 16:41:44 +08:00
Klemens Morgenstern
f64bc8a6d4 Update config.yml 2019-04-06 16:34:26 +08:00
Klemens Morgenstern
102834130d Update config.yml 2019-04-06 16:28:48 +08:00
Klemens Morgenstern
fdc6a11cbc Update config.yml 2019-04-06 16:09:16 +08:00
Klemens Morgenstern
19b20f55ce Update config.yml 2019-04-06 16:04:28 +08:00
Klemens David Morgenstern
60d072ce46 Merge branch 'develop' into circleci 2019-04-06 15:29:22 +08:00
Klemens David Morgenstern
34f05b9276 Merge branch 'develop' into asio_no_deprecated 2019-04-06 15:22:10 +08:00
Klemens David Morgenstern
1b476b0430 Closes #65 2019-04-06 15:21:52 +08:00
Klemens David Morgenstern
b294710e60 fixed self-pipe issue 2019-04-06 14:42:08 +08:00
Klemens David Morgenstern
f8cd325d1b trying circleci 2019-04-05 15:13:14 +08:00
Klemens David Morgenstern
2a6c23e173 typo fix 2019-04-04 18:11:33 +08:00
Klemens David Morgenstern
d7768b7221 Merge branch 'develop' into asio_no_deprecated 2019-04-04 17:57:28 +08:00
Klemens David Morgenstern
b8821eac57 should close #78 2019-03-30 23:14:25 +08:00
Klemens David Morgenstern
d20b64cf37 removed unnecessary int to remove warning 2019-03-29 01:39:00 +08:00
Klemens David Morgenstern
f0ddd6ca29 typo & structure fix 2019-03-29 00:57:11 +08:00
Klemens David Morgenstern
574d9e09d6 should close #193 2019-03-29 00:32:12 +08:00
Klemens Morgenstern
7085a50f36 Merge pull request #77 from SimonEbner/develop
Fix leaking pipe
2019-03-23 00:01:27 +08:00
Klemens Morgenstern
0485459da2 Merge pull request #76 from orgads/patch-1
Fix signed/unsigned comparison
2019-03-22 23:56:13 +08:00
Simon Ebner
318439af2e Fix Issue 62
Fixes a leaking pipe. See https://github.com/boostorg/process/issues/62
2019-03-22 15:27:35 +01:00
Orgad Shaneh
4d52ff362f Fix signed/unsigned comparison 2019-03-21 23:39:27 +02:00
Klemens David Morgenstern
8d48d9cbfa dumb workaround -> fix report.ci detection! 2019-03-21 16:21:40 +08:00
Klemens David Morgenstern
f25c31c847 added test by @grives as recommended in #69 2019-03-21 12:51:32 +08:00
Bruno Martinez
192191ecfb typo 2019-03-05 12:30:06 -03:00
Klemens David Morgenstern
3eacae5e38 Merge branch 'develop' 2019-03-04 12:16:07 +08:00
Klemens David Morgenstern
14b294c10c Merge branch 'develop' of github.com:boostorg/process into develop 2019-03-04 12:14:56 +08:00
Klemens Morgenstern
881da4f9e2 Merge pull request #191 from klemens-morgenstern/develop
Update master
2019-02-28 12:44:50 +08:00
Filip Konvička
3aeb6601cd Merge pull request #1 from fkonvick/windows-shell-dquotes
Fix double quotes processing on Windows
2019-02-27 14:05:59 +01:00
Filip Konvička
8a7c37617e Fix double quotes processing on Windows
Fix double quotes processing on Windows:
- quotes should only be added when not already present
- quotes need to be used when an argument includes spaces or double quotes
- quotes inside an argument should be doubled (that's the way Windows does escaping)
2019-02-27 14:02:45 +01:00
Klemens Morgenstern
2758e8d438 Merge pull request #190 from klemens-morgenstern/report-ci
Report ci
2019-02-27 12:44:12 +08:00
Klemens David Morgenstern
b5a6b4b945 updated readme 2019-02-25 12:59:56 +08:00
Klemens David Morgenstern
ac94f81b77 renamed wait test suite 2019-02-25 09:42:45 +08:00
Klemens David Morgenstern
06747d7dd3 added test suites 2019-02-25 00:04:09 +08:00
Klemens David Morgenstern
fb9b9215e0 another windows fix 2019-02-24 22:37:13 +08:00
Klemens David Morgenstern
eed0505f6e trying to fix the windows build 2019-02-24 21:26:34 +08:00
Klemens David Morgenstern
8f6aa8bcff added root-dir parameter 2019-02-24 17:14:28 +08:00
Klemens David Morgenstern
6f9cabbd04 trying to fix the build scripts 2019-02-24 13:10:03 +08:00
Klemens David Morgenstern
355d20faf3 update async pipe executor assignment 2019-02-24 00:51:44 +08:00
Klemens David Morgenstern
15c4a64a81 updated asio fwd 2019-02-23 23:38:20 +08:00
Klemens David Morgenstern
49ec65a735 updated yamls 2019-02-23 22:29:04 +08:00
Klemens David Morgenstern
7cdea96caf added report-ci 2019-02-23 20:51:24 +08:00
Klemens Morgenstern
8bf7da3b6b Merge pull request #71 from killerbot242/changes
fix warning due to extra semi colon
2019-02-03 21:19:45 +08:00
Lieven de Cock
c1ad9d1227 fix warning due to extra semi colon
In file included from /home/ldco/boost/include/boost/process/detail/on_exit.hpp:12:0,
                 from /home/ldco/boost/include/boost/process/async.hpp:33,
                 from /home/ldco/boost/include/boost/process.hpp:23,
                 from /home/ldco/Projects/Teaching/Teaching/Boost/Process/Process1/src/main.cpp:7:
/home/ldco/boost/include/boost/process/detail/posix/on_exit.hpp:30:6: warning: extra ‘;’ [-Wpedantic]
     };
      ^
In file included from /home/ldco/boost/include/boost/process/async.hpp:42:0,
                 from /home/ldco/boost/include/boost/process.hpp:23,
                 from /home/ldco/Projects/Teaching/Teaching/Boost/Process/Process1/src/main.cpp:7:
/home/ldco/boost/include/boost/process/detail/posix/io_context_ref.hpp:67:6: warning: extra ‘;’ [-Wpedantic]
     };
      ^
2019-01-29 12:57:43 +01:00
Thomas Suckow
1b6ccb6d39 Guard against EINTR in basic_pipe
Based on the code from executor.hpp, a signal can cause invoking a child process to fail because reading/writing the pipe was interrupted.
2019-01-22 09:22:52 -08:00
Klemens David Morgenstern
e2e2b5ddb2 Merge branch 'develop' 2019-01-08 15:02:41 +08:00
Klemens David Morgenstern
b4584dd0b0 Merge branch 'develop' of github.com:boostorg/process into develop 2019-01-08 15:02:17 +08:00
Klemens Morgenstern
55e5d178bd Merge pull request #67 from amensel/develop
Use the non-deprecated ASIO APIs.
2019-01-07 17:30:48 +07:00
Klemens David Morgenstern
f778702257 closes #188 2019-01-07 17:12:58 +07:00
Klemens David Morgenstern
b4ff07cfcb fixed BOOST_NO_ANSI_APIS issue in basic_pipe, closed #26 2019-01-07 17:03:00 +07:00
Adam Mensel
d43858078f Use the non-deprecated function name. 2019-01-04 15:32:38 -07:00
Adam Mensel
f2cf918be5 Missed one post call. 2019-01-04 15:24:28 -07:00
Adam Mensel
54dd027a64 Use the non-deprecated ASIO APIs. 2019-01-04 11:57:47 -07:00
Klemens David Morgenstern
1ea894ab30 Closes #187 2018-12-15 11:37:51 +07:00
Klemens David Morgenstern
92c45f4b61 testing for actual timing 2018-12-14 23:33:26 +07:00
Klemens Morgenstern
03cba8f5bd Merge pull request #185 from klemens-morgenstern/develop
Develop update
2018-12-14 12:17:46 +07:00
Klemens David Morgenstern
97f08ba0b3 Merge remote-tracking branch 'remotes/origin/master' into develop
# Conflicts:
#	doc/tutorial.qbk
2018-12-14 12:17:17 +07:00
Klemens David Morgenstern
c843815c6c added multithreading for osx only 2018-12-14 11:31:08 +07:00
Klemens David Morgenstern
b5785b3370 added -j8 to travis 2018-12-13 14:17:54 +07:00
Klemens David Morgenstern
a6e5a5a619 typoe fix 2018-12-13 11:45:48 +07:00
Klemens David Morgenstern
2d627f633b added group_wait 2018-12-12 00:19:14 +07:00
Klemens David Morgenstern
ef486764ac added check if forked proc is running 2018-12-11 23:13:20 +07:00
Klemens David Morgenstern
fce3962376 WNOHANG test 2018-12-11 21:58:17 +07:00
Klemens David Morgenstern
5a40a0ee9c typo fix 2018-12-11 18:24:25 +07:00
Klemens David Morgenstern
4bf795922d trying nanosleep 2018-12-11 18:05:24 +07:00
Klemens David Morgenstern
1646b240c7 trying to fix wait_for 2018-12-11 17:19:37 +07:00
Klemens David Morgenstern
d4f7bfaa6c double timeout for terminate... 2018-12-11 16:17:29 +07:00
Klemens David Morgenstern
bac06d2bc7 added timeout to terminate 2018-12-11 15:38:41 +07:00
Klemens David Morgenstern
579499d9e8 group_wait 2018-12-11 15:06:08 +07:00
Klemens David Morgenstern
b8c46bfc47 trying explicit alarm for osx 2018-12-11 14:36:04 +07:00
Klemens David Morgenstern
d234ce4f63 bumped up the log_level 2018-12-11 14:16:48 +07:00
Klemens David Morgenstern
1be807e748 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2018-12-11 13:52:09 +07:00
Klemens David Morgenstern
f4db2613eb disabling valgrind for osx 2018-12-11 13:50:10 +07:00
Klemens Morgenstern
bae6098e91 Merge pull request #186 from jasonmccampbell/native-exit-code
Allow access to the uninterpreted exit code
2018-12-11 10:15:50 +07:00
Jason McCampbell
c40153fab1 Allow access to the uninterpreted exit code to allow calls to
distinugish between exit codes and exit due to signals (POSIX)
2018-12-11 02:41:27 +00:00
Klemens David Morgenstern
e5eec4a5dc updated develop thingy 2018-12-11 01:02:28 +07:00
Klemens David Morgenstern
887bb8c482 removed notify_fork again 2018-12-11 00:41:47 +07:00
Klemens David Morgenstern
0642bf5e70 added had SIGALARM For apple 2018-12-11 00:15:17 +07:00
Klemens David Morgenstern
513208a117 travis fix 2018-12-10 23:31:57 +07:00
Klemens David Morgenstern
49247f0a83 revamped async 2018-12-10 22:42:05 +07:00
Klemens David Morgenstern
ccb7dd482a implemented badges for OSX / Linux 2018-12-10 17:23:12 +07:00
Klemens David Morgenstern
08f40ff46b trying BOOST_TEST_CATCH_SYSTEM_ERRORS=no for osx 2018-12-10 15:21:03 +07:00
Klemens David Morgenstern
956f7b5fdf updated group_wait to remove wrong condition 2018-12-10 15:06:26 +07:00
Klemens David Morgenstern
40d0f8c401 trying to fix group wait 2018-11-20 20:40:44 +07:00
Klemens David Morgenstern
cbc7580fcd updated ansi_apps by api-guard 2018-11-20 20:15:46 +07:00
Klemens David Morgenstern
f96dfd6e8f typo fix 2018-11-15 15:55:47 +07:00
Klemens David Morgenstern
ea24ebaf92 added notify fork back into io_context_ref 2018-11-15 15:07:34 +07:00
Klemens David Morgenstern
504e760760 added timeout to wait-test 2018-11-15 14:30:11 +07:00
Klemens David Morgenstern
c5e7cfb4f5 added called-bool & time out for exit_code test 2018-11-15 13:53:01 +07:00
Klemens David Morgenstern
9904e3a5e8 removed BOOST_TEST_IGNORE_SIGCHLD from test 2018-11-15 12:54:48 +07:00
Klemens David Morgenstern
191673b049 updated waitpid functionality 2018-11-15 11:51:33 +07:00
Klemens David Morgenstern
3a6d11f9b8 damn typos 2018-11-15 11:22:43 +07:00
Klemens David Morgenstern
e022ad3742 typo fix, again 2018-11-15 11:06:09 +07:00
Klemens David Morgenstern
16d9350992 typo fix 2018-11-15 10:51:29 +07:00
Klemens David Morgenstern
5e1d7b6901 updated sigchld_service to check first check if the child is actually running 2018-11-15 10:35:52 +07:00
Klemens David Morgenstern
82d4cef182 trying to queue process creation 2018-11-13 19:06:03 +07:00
Klemens David Morgenstern
5a112ea4bb Merge branch 'develop' into travis_osx
# Conflicts:
#	.travis.yml
#	include/boost/process/detail/posix/wait_for_exit.hpp
#	include/boost/process/detail/posix/wait_group.hpp
2018-11-13 17:47:41 +07:00
Klemens David Morgenstern
b058e1cadf trying to remove BOOST_TEST_IGNORE_SIGCHLD 2018-11-13 16:57:06 +07:00
Klemens David Morgenstern
a8b28ef262 fixed timeout values 2018-11-13 14:57:29 +07:00
Klemens David Morgenstern
080f3fb074 checking if it's just an asio timing problem 2018-11-13 14:37:57 +07:00
Klemens David Morgenstern
997f10c7e9 fixed wrong timeout values 2018-11-13 14:20:39 +07:00
Klemens David Morgenstern
4ced4d0933 typo fix in wait functions 2018-11-13 13:52:17 +07:00
Klemens David Morgenstern
eafe8e327a removed auto from lambdas 2018-11-13 13:49:28 +07:00
Klemens David Morgenstern
a4c89a3dec added timeouts to async test 2018-11-13 13:30:14 +07:00
Klemens David Morgenstern
902390d57a still trying for the osx on travis 2018-11-13 11:56:38 +07:00
Klemens David Morgenstern
5c55590922 trying llvm now 2018-11-12 20:23:46 +07:00
Klemens David Morgenstern
0485932309 typo fix 2018-11-12 19:53:55 +07:00
Klemens David Morgenstern
e1a3aded4e added . output for filter for section warning 2018-11-12 19:32:21 +07:00
Klemens David Morgenstern
5b2d5c76c8 nsleep -> nanosleep 2018-11-12 18:59:18 +07:00
Klemens David Morgenstern
2c3c9e84a5 added include of unistd.h 2018-11-12 18:40:48 +07:00
Klemens David Morgenstern
ad90ca6366 CI fixes and attempt on new wait_for mechanic
Squashed commit of the following:

commit 88952f0ab2
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 18:27:04 2018 +0700

    rolling back the --coverage option

commit 29cd54ea8c
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 18:12:33 2018 +0700

    another attempt

commit c2ee6da367
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 17:54:53 2018 +0700

    trying to get the sanitization to work here

commit 317801ca5e
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 17:10:36 2018 +0700

    added -lprofile_rt

commit 3923da14f7
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 16:56:32 2018 +0700

    attempting new timed wait for OSX

commit 5aa691cc3a
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 16:32:11 2018 +0700

    adding valgrind to build

commit 04712d57f4
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 16:09:34 2018 +0700

    changin pipe mode

commit ed4c861e78
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Mon Nov 12 15:37:08 2018 +0700

    trying to filter section warnings
2018-11-12 18:39:31 +07:00
Klemens David Morgenstern
88952f0ab2 rolling back the --coverage option 2018-11-12 18:27:04 +07:00
Klemens David Morgenstern
29cd54ea8c another attempt 2018-11-12 18:12:33 +07:00
Klemens David Morgenstern
c2ee6da367 trying to get the sanitization to work here 2018-11-12 17:54:53 +07:00
Klemens David Morgenstern
317801ca5e added -lprofile_rt 2018-11-12 17:10:36 +07:00
Klemens David Morgenstern
3923da14f7 attempting new timed wait for OSX 2018-11-12 16:56:32 +07:00
Klemens David Morgenstern
5aa691cc3a adding valgrind to build 2018-11-12 16:32:11 +07:00
Klemens David Morgenstern
04712d57f4 changin pipe mode 2018-11-12 16:09:34 +07:00
Klemens David Morgenstern
ed4c861e78 trying to filter section warnings 2018-11-12 15:37:08 +07:00
Klemens David Morgenstern
587eaa8054 yaml file fix 2018-11-12 14:55:38 +07:00
Klemens David Morgenstern
78b5ea1f6b checking the sigtimedwait macro --> test should fail on OSX & work on Linux 2018-11-12 14:48:58 +07:00
Klemens David Morgenstern
6412aa3ece trying badging properly 2018-11-12 14:34:50 +07:00
Klemens David Morgenstern
68a3ba0c41 Merge branch 'develop' into travis_osx 2018-11-12 14:29:36 +07:00
Klemens David Morgenstern
ecaba9efc1 typo fix 2018-11-12 14:04:50 +07:00
Klemens David Morgenstern
fb682944d9 trying to install gcc-5 for osx 2018-11-12 13:49:55 +07:00
Klemens David Morgenstern
9c60e4987c added matrix links to readme 2018-11-09 11:06:17 +07:00
Klemens David Morgenstern
59b361fb46 trying to use osx 2018-11-09 11:01:35 +07:00
Klemens David Morgenstern
f3b2c0a67e typo fixes 2018-10-26 11:35:33 +07:00
Klemens David Morgenstern
69c04d5e29 updated doc to say io_context instead of io_service 2018-10-26 10:55:28 +07:00
Klemens David Morgenstern
78f4115a32 Implement move operations for streams, closes #173 2018-10-26 10:53:47 +07:00
Klemens David Morgenstern
9b1b83f5e7 Merge branch 'develop' of github.com:boostorg/process into develop 2018-10-26 10:38:46 +07:00
Klemens Morgenstern
bd859e98d3 Merge pull request #54 from tnixeu/develop
removes boost::asio:: from example in doc
2018-10-26 14:35:06 +11:00
tnixeu
d7accdcf0c fixes some string replacements issues in doc. Some replacements caused wrong namespaces. 2018-10-20 13:04:17 +02:00
tnixeu
d159fea7b8 removes boost::asio:: from example in doc 2018-10-20 11:50:45 +02:00
Klemens David Morgenstern
b5b91d578d Merge branch 'develop' of github.com:boostorg/process into develop 2018-10-01 10:01:40 +07:00
Klemens Morgenstern
498055bc8d Merge pull request #52 from pivotal-jbarrett/isrunning-solaris
Changes still_active constant to support Solaris.
2018-09-28 00:04:08 +07:00
Jacob Barrett
502169a5ad Changes still_active constant to support Solaris.
The use of the WIFSTOPPED bits did not go far enough on Solaris. It
is expected to also have a non-zero value in the next bytes. This
new value is tested be valid on Linux, MacOS and Solaris.

Fixes #51
2018-09-27 07:36:03 -07:00
Klemens David Morgenstern
42fbbbd8a6 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2018-09-27 10:02:01 +07:00
Klemens David Morgenstern
dd0b26de4c closes #180 2018-09-27 10:00:29 +07:00
Klemens Morgenstern
10665bfaff Merge pull request #181 from krwalker/fix-vc-c4458-warnings
Fix warnings: decl. of 'x' hides class member
2018-09-27 09:55:41 +07:00
K. R. Walker
2576ed166f Fix warnings: decl. of 'x' hides class member
Address C4458 warnings when compiled with Visual C++
2018-09-26 16:54:46 -06:00
Klemens David Morgenstern
9ad7413189 Merge branch 'develop' 2018-09-26 15:18:30 +07:00
Klemens David Morgenstern
9cd405a66f Squashed commit of the following:
commit 4107154e8056ec3460ccd70dea6b919e8c71fc59
Author: Klemens David Morgenstern <klemens.morgenstern@gmx.net>
Date:   Wed Sep 26 14:42:00 2018 +0700

    trying to fix the coverage reporting
2018-09-26 15:17:56 +07:00
Klemens David Morgenstern
fc6773d7d3 trying to improve coverage 2018-09-26 14:03:13 +07:00
Klemens David Morgenstern
c3b707b709 Merge branch 'master' of github.com:boostorg/process 2018-09-26 13:53:10 +07:00
Klemens Morgenstern
57e9dfb705 Merge pull request #179 from klemens-morgenstern/develop
Update for master
2018-09-26 13:50:47 +07:00
Klemens David Morgenstern
4fd8887601 fixed group wait-for on windows 2018-09-26 11:50:18 +07:00
Lemmy
3cf4bf6480 Hope fully fixed group waiting 2018-09-25 17:32:32 +02:00
Lemmy
256523d36e Merge branch 'develop' of https://github.com/klemens-morgenstern/boost-process into develop 2018-09-25 11:45:23 +02:00
Lemmy
6ba8e88def wait-group fix 2018-09-25 11:45:04 +02:00
Klemens David Morgenstern
f139f863a0 typo fix in test 2018-09-25 16:10:11 +07:00
Lemmy
0938103427 Reworked wait_for_exit, concerns #99 and #112 2018-09-25 10:45:54 +02:00
Lemmy
e72127f9f8 Implemented proper wait_for for group_handles 2018-09-25 10:27:40 +02:00
Lemmy
eea73753b5 Fixed group wait in linux 2018-09-25 07:40:07 +02:00
Klemens David Morgenstern
4f3b425073 fixed group-wait, finally 2018-09-25 02:37:51 +07:00
Klemens David Morgenstern
dcb8a0266a preserving creation_flags, closes #176 2018-09-24 23:42:53 +07:00
Klemens David Morgenstern
99285a9de6 fixed windows-h variant 2018-09-24 23:27:01 +07:00
Klemens David Morgenstern
6cc31b93d8 readded BOOST_WINAPI_WINAPI_CC 2018-09-24 23:10:33 +07:00
Klemens David Morgenstern
d1ce19d848 fixes #178 2018-09-21 10:48:03 +07:00
Klemens Morgenstern
f00895a9fc Update tutorial.qbk
closes #49
2018-09-11 14:38:49 +08:00
Klemens David Morgenstern
8d2bd87707 ALternative (typeless) implementation of #177 2018-08-29 09:37:07 +08:00
Klemens David Morgenstern
44162ecf22 removed errornous noexcept 2018-06-19 18:34:39 +08:00
Klemens David Morgenstern
d709c1cd07 fixed tutorial example type 2018-06-18 09:46:15 +08:00
Klemens Morgenstern
90d2c0ceca Merge pull request #168 from klemens-morgenstern/develop
1.68 release merge
2018-06-13 22:00:09 +03:00
Klemens David Morgenstern
9549ffe7e1 capture list fix 2018-05-27 11:39:56 +02:00
Klemens David Morgenstern
dd0edb4aee Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2018-05-26 22:07:15 +02:00
Klemens David Morgenstern
3029f4623a closes #41 2018-05-26 22:06:54 +02:00
Klemens David Morgenstern
74606db379 Merge branch 'bugfixing' into develop 2018-05-26 22:00:12 +02:00
Klemens David Morgenstern
81803868a3 closes #45 2018-05-26 21:59:58 +02:00
Klemens David Morgenstern
eff42f91ef closes #42 2018-05-26 21:57:25 +02:00
Klemens David Morgenstern
a25b6ca35b closes #32 2018-05-26 21:55:07 +02:00
Klemens Morgenstern
1c8323650d Merge pull request #166 from egorpugin/patch-2
Add missing returns on windows side.
2018-05-26 20:46:14 +02:00
Klemens David Morgenstern
52f030a83c closes #167 2018-05-26 20:32:08 +02:00
Egor Pugin
9cc651bdeb Add missing returns on windows side. 2018-05-09 20:09:32 +03:00
Klemens Morgenstern
128cb0283d Merge pull request #165 from egorpugin/patch-2
Add missing returns
2018-05-09 14:41:31 +02:00
Egor Pugin
bb259f8f16 Add missing returns 2018-05-09 15:16:15 +03:00
Klemens Morgenstern
bb1bb431e5 Merge pull request #163 from tomaszjonak/develop
Fix async_pipe::async_read_some always returning 0
2018-05-04 17:22:48 +02:00
Tomasz Jonak
41b7e30c18 Add missing return to async_pipe::async_{read,write}_some 2018-05-04 14:03:54 +00:00
Klemens David Morgenstern
f1c6909eb0 Merge remote-tracking branch 'remotes/origin/develop' 2018-04-05 20:35:52 +02:00
Klemens Morgenstern
35fda5aa6a Update job_workaround.hpp 2018-04-05 20:12:51 +02:00
Klemens Morgenstern
1f7f805858 Merge pull request #158 from klemens-morgenstern/develop
Update job_workaround.hpp
2018-04-05 11:16:39 +02:00
Klemens Morgenstern
d47b7f7ac4 Update job_workaround.hpp 2018-04-05 10:08:00 +02:00
Klemens David Morgenstern
2bc2531d2a Merge branch 'develop' 2018-04-04 20:55:25 +02:00
Klemens David Morgenstern
c5798fdf7f added write_some and read_some overloads - closes #35 2018-03-13 10:11:01 +08:00
Klemens David Morgenstern
5e43e7c07c Merge branch 'develop' of github.com:boostorg/process into develop 2018-03-11 20:58:22 +01:00
Klemens David Morgenstern
6abce365c5 started on asio_no_deprecated.cpp 2018-03-11 20:57:18 +01:00
Klemens Morgenstern
4fc4784506 Merge pull request #34 from Lastique/update_winapi_cc
Switch WINAPI calling convention macros to the replacements from Boost.WinAPI
2018-03-11 20:56:06 +01:00
Andrey Semashev
900aab5d6d Switched WINAPI calling convention macros to the replacements from Boost.WinAPI
WINAPI macro definition in Boost.WinAPI is deprecated as it may clash with
the macro defined in Windows SDK.
2018-03-11 20:20:49 +03:00
Klemens Morgenstern
f61a61cf59 Merge pull request #144 from klemens-morgenstern/develop
Another master updates
2018-02-26 23:25:28 +01:00
Klemens Morgenstern
8e8d36772e Merge pull request #151 from amerry/is-running-fixes
is_running fixes
2018-02-26 13:53:41 +01:00
Alex Merry
ec04919825 Rename tests to reflect what they do 2018-02-22 14:32:54 +00:00
Alex Merry
6625999765 Check the "still running" status code does not clash with WIFSIGNALED
This makes the static_assert reflect the actual assumptions in the code.
2018-02-22 14:31:22 +00:00
Alex Merry
0d3688aca5 Ignore stopped processes
is_running should only concern itself with terminated processes, not
stopped processes (which might be continued later).
2018-02-22 14:12:46 +00:00
Klemens Morgenstern
40be786c43 Merge pull request #150 from amerry/async-exit-status
Return the same exit status in the async handler as the sync method
2018-02-22 13:43:06 +01:00
Klemens Morgenstern
d4a0444223 Merge pull request #147 from amerry/args
Always set arguments on POSIX
2018-02-22 13:05:33 +01:00
Klemens Morgenstern
f99cfe77f4 Merge pull request #148 from pepsiman/patch-1
Fix grammar in tutorial
2018-02-22 12:59:52 +01:00
Alex Merry
ed32531369 Return the same exit status in the async handler as the sync method
Previously, if the process terminated via a signal on posix, the async
handler would provide an exit status of 0.
2018-02-22 11:53:42 +00:00
Malcolm Parsons
751af041cd Fix grammar in tutorial 2018-02-22 10:29:59 +00:00
Alex Merry
a0ceebd59f Fix copyright headers
Insofar as there are copyrights on these changes, they are owned by my
employer, as I'm doing this on company time.
2018-02-22 09:02:02 +00:00
Klemens Morgenstern
b0b37f2ce6 Merge pull request #146 from amerry/test-for-sigchld-fix
Add unit tests for async exit watching with multiple io_contexts
2018-02-21 17:50:27 +01:00
Alex Merry
cf1f904ae2 Fix compilation on MSVC 2018-02-21 15:53:46 +00:00
Alex Merry
8aaf53d76d Always set arguments on POSIX
Explicitly specifying an executable (either with boost::filesystem::path
or boost::process::exe) and no arguments causes NULL to be passed as the
argument list.

Not only is this unexpected behaviour for the child process (which
doesn't even have argv[0]), it is not portable across UNIX systems. From
the execve(2) man page on Linux:

"On Linux, either argv or envp can be specified as NULL, which has the
same effect as specifying these arguments as a pointer to a list
containing a single NULL pointer.  Do not take advantage of this
misfeature!  It is nonstandard and nonportable:  on  most other UNIX
systems doing this will result in an error (EFAULT)."
2018-02-21 15:43:32 +00:00
Alex Merry
76c03ded89 Add unit tests for async exit watching with multiple io_contexts
These tests fail without the commit "Only reap children we are watching
for when handling SIGCHLD" applied, and succeed with it applied.
2018-02-21 15:13:28 +00:00
Klemens Morgenstern
e6fa19b4c5 Merge pull request #145 from amerry/async-wait-fix
Only reap children we are watching for when handling SIGCHLD
2018-02-20 19:53:54 +01:00
Alex Merry
92ee239891 Only reap children we are watching for when handling SIGCHLD
There may be other io_context instances with child instances, and child
instances with no associated io_context. If we pass 0 to ::waitpid(), we
will reap their processes as well, without updating the state of the
corresponding child instance.

Instead, we call `::waitpid` once for each child we are watching for.
This has some amount of overhead (multiple system calls), but ensures
correct behaviour (providing nothing other than an asio::signal_set is
watching for SIGCHLD).
2018-02-20 14:32:33 +00:00
Klemens Morgenstern
c37e2a7524 Merge pull request #142 from cls/search_path_returns_dir
Fix search_path not to return directories on POSIX
2018-02-14 15:41:58 +01:00
Connor Lane Smith
a610fe74ff Fix search_path not to return directories on POSIX 2018-02-14 13:56:34 +00:00
Klemens Morgenstern
ea49952da2 Merge pull request #141 from markus-t314/fix_issue139
Fix: Inconsistent behaviour in various overloaded functions/methods #139
2018-02-09 21:15:19 +01:00
Markus Tillinger
a55946eb5d Fix: Inconsistent behaviour in various overloaded functions/methods #139
Removed duplicated code in overloaded functions.
Replaced system_clock with steady_clock.
2018-02-08 21:49:49 +01:00
Klemens Morgenstern
9f6c338631 Merge pull request #140 from klemens-morgenstern/develop
master update
2018-02-07 00:19:10 +01:00
Klemens David Morgenstern
60302c0017 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2018-02-06 20:20:18 +01:00
Klemens David Morgenstern
08eaf8b7a1 added BOOST_NO_ANSI_APIS support, closes #26 2018-02-06 20:20:02 +01:00
Klemens Morgenstern
cc70ec9362 Update pipe_in.hpp 2018-02-06 10:29:16 +01:00
Klemens Morgenstern
b58ecc7c9d Update async_in.hpp 2018-02-06 10:27:16 +01:00
Klemens Morgenstern
668cbcdaf4 Update windows.hpp 2018-02-06 10:23:02 +01:00
Klemens David Morgenstern
6d7cbd0989 closes #83 2018-02-06 00:32:55 +01:00
Klemens David Morgenstern
0764f788a6 typo fix 2018-02-06 00:24:45 +01:00
Klemens David Morgenstern
2b95dd7011 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2018-02-06 00:08:26 +01:00
Klemens David Morgenstern
ae380c30ad added CREATE_NO_WINDOW flags, closes #129 2018-02-06 00:07:35 +01:00
Klemens Morgenstern
d2265890bd Merge pull request #138 from markus-t314/consistent_wait_handling
Fixed inconsistent posix-wait-handling
2018-02-05 23:42:04 +01:00
Klemens Morgenstern
831d49c1b3 Merge pull request #137 from markus-t314/fix_issue136
Fix: [posix] inconsistent exit status when child received signal #136
2018-02-05 23:38:59 +01:00
Klemens Morgenstern
6935c53510 Merge pull request #132 from egorpugin/patch-1
Fix initialization of atomic var. This fixes mingw build.
2018-02-05 23:34:11 +01:00
Klemens David Morgenstern
f30d90a179 Merge remote-tracking branch 'remotes/boostorg/develop' into develop 2018-02-05 23:32:17 +01:00
Klemens Morgenstern
55cfcecfb8 Merge pull request #27 from adrianimboden/develop
fix use of uninitalized variable
2018-02-05 23:16:21 +01:00
Klemens Morgenstern
233f46a2cb Merge pull request #30 from cinghiale/patch-1
update the code snippets to reflect the doc
2018-02-05 23:15:15 +01:00
Markus Tillinger
342554b3d8 Fixed inconsistent posix-wait-handling
Refactored: Removed duplicated code
Made wait_until compatible with steady_clock
2018-02-03 22:11:37 +01:00
Markus Tillinger
7aa812a0e1 Fix: [posix] inconsistent exit status when child received signal #136 2018-02-03 17:47:14 +01:00
Klemens Morgenstern
c4ffd0c18d Merge pull request #135 from klemens-morgenstern/develop
Appveyor fixes
2018-02-02 23:26:12 +01:00
Klemens David Morgenstern
a411f06dc4 Merge remote-tracking branch 'remotes/origin/master' into develop
# Conflicts:
#	test/Jamfile.jam
#	test/async_system_stackless.cpp
2018-02-02 22:37:32 +01:00
Klemens David Morgenstern
d085262076 added /bigobj flag for msvc 2018-02-02 22:14:42 +01:00
Klemens David Morgenstern
0396740467 splitted up the async_system tests 2018-02-02 21:52:14 +01:00
Klemens Morgenstern
0fd7de9481 Merge pull request #134 from hrayrbabajanyan/patch-1
eval_exit_status would return 0 in case if the child received SIBABRT
2018-02-01 20:44:00 +01:00
hrayrbabajanyan
ba790dad0a eval_exit_status would return 0 in case if the child received SIBABRT 2018-02-01 02:53:24 +04:00
David Mugnai
f2e8776965 update the code snippets to reflect the doc 2018-01-23 23:35:54 +01:00
Adrian Imboden
444d5eb702 fix use of uninitalized variable 2018-01-06 13:36:42 +01:00
Egor Pugin
3e12e989ab Fix initialization of atomic var. This fixes mingw build. 2018-01-06 14:04:32 +03:00
klemens-morgenstern
917030c3cd Merge branch 'develop' 2017-11-11 01:02:31 +01:00
Klemens Morgenstern
faf848bd8b Merge pull request #125 from ca-l-eb/fixes
Fix async_pipe reassignment and child_decl
2017-11-05 15:39:13 -05:00
Caleb Dechant
d78c7901b3 Revert async_pipe dtor to original 2017-11-05 11:48:20 -08:00
Klemens Morgenstern
09e98d8746 Merge pull request #122 from egorpugin/develop
Fix multithreaded async pipes creation.
2017-11-05 13:47:56 -05:00
Egor Pugin
ab6e5b54ec Rename to io_context 2017-11-05 20:21:49 +03:00
Egor Pugin
b268e0e1fb Change atomic var to size_t. 2017-11-05 17:28:42 +03:00
Caleb Dechant
996f4b357c Fix child_decl's move constructor
The _terminated field is now copied from the moved child.
2017-11-04 17:25:00 -07:00
Caleb Dechant
8ce3e760dc Fix async_pipe move assignment and destructor
Simplify async_pipe's move assignment so it now properly closes the old
pipe handles by swapping the asio stream_descriptors.

Reassigning async_pipes previously raised exceptions complaining about
EBADF or EEXIST. I think the ::close calls in the destructor and the
move assignment were not closing the pipe correctly.
2017-11-04 17:22:15 -07:00
klemens-morgenstern
6e60928b1f Merge branch 'develop' of github.com:boostorg/process into develop 2017-11-03 00:14:23 +01:00
Klemens Morgenstern
e27baa7628 Merge pull request #24 from ca-l-eb/fix-terminate
Fix move assignment for child_decl
2017-11-02 19:13:17 -04:00
Caleb Dechant
337a6e3e83 Fix move assignment for child
_terminate field is now copied from the move assingment operator on
child. This fixes the issue that a child process could previously only
be terminated() once (even after reassignment).
2017-11-02 16:03:05 -07:00
klemens-morgenstern
bbfc334c93 split up the async_system test 2017-10-28 13:04:01 +02:00
klemens-morgenstern
1a9fa2cc2c Merge branch 'develop' 2017-10-28 12:09:36 +02:00
klemens-morgenstern
1296e02372 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2017-10-25 18:49:13 +02:00
klemens-morgenstern
585104605e removed variadic arg in test 2017-10-25 18:48:55 +02:00
Klemens Morgenstern
d0c07b7c63 Update windows_specific.cpp 2017-10-25 12:20:00 +02:00
Klemens Morgenstern
7c9ce7f8b9 Update exit_code.cpp 2017-10-25 10:55:40 +02:00
Klemens Morgenstern
c388f24d6e Update windows_specific.cpp 2017-10-25 10:53:46 +02:00
klemens-morgenstern
b1f50e953b some additions attempted fixes for the windows part 2017-10-25 09:07:23 +02:00
klemens-morgenstern
852d8f3d9d renamed windows/io_service_ref.hpp 2017-10-24 23:54:58 +02:00
klemens-morgenstern
2c026e43a8 removed constness for gcc 4.8 2017-10-24 23:17:42 +02:00
klemens-morgenstern
51396227a0 renamed native() to native_handle() 2017-10-24 23:15:53 +02:00
klemens-morgenstern
75d3049199 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2017-10-24 22:36:48 +02:00
Klemens Morgenstern
3d9a8b2353 Merge pull request #22 from Lastique/update_winapi
Update Boost.WinAPI usage to the new location and namespace
2017-10-24 16:35:40 -04:00
Klemens Morgenstern
8097c2e07a Merge pull request #19 from chriskohlhoff/asio-updates-1
Updates to compile against latest asio.
2017-10-24 16:34:06 -04:00
Andrey Semashev
d9231d466c Updated Boost.WinAPI usage to the new location and namespace. 2017-10-24 23:27:56 +03:00
Christopher Kohlhoff
153e05eac0 Updates to compile against latest asio. 2017-10-23 21:23:44 +11:00
Klemens Morgenstern
883b6ac937 Merge pull request #15 from ganboing/develop
fix uninitialized variable and close(-1) behavior
2017-10-22 15:41:53 -04:00
Klemens Morgenstern
764fff1f65 Merge pull request #17 from gevorgvoskanyan/search_path_unused_var
remove unused variable in boost::process::detail::posix::search_path()
2017-10-22 15:35:58 -04:00
Klemens Morgenstern
16ff42290a Merge pull request #16 from gevorgvoskanyan/doc_typos
Some typo fixes
2017-10-22 15:35:43 -04:00
Gevorg Voskanyan
6adf1bf545 fix param path comment for search_path() 2017-10-22 23:20:02 +04:00
Gevorg Voskanyan
126659f2f9 remove unused variable in boost::process::detail::posix::search_path() 2017-10-22 22:50:45 +04:00
Gevorg Voskanyan
90adf118ac s/a environment/an environment 2017-10-22 22:30:24 +04:00
Gevorg Voskanyan
63952fa2a6 s/seperated/separated 2017-10-22 22:20:27 +04:00
Bo Gan
2f00162817 fix uninitialized variable and close(-1) behavior 2017-09-12 12:37:20 -07:00
Klemens Morgenstern
28b402eed1 Merge pull request #120 from klemens-morgenstern/vfork-check-fix
Updated vfork check
2017-08-29 13:22:32 -04:00
Egor Pugin
3f12d82e00 Rename io service. 2017-08-29 14:38:23 +03:00
Egor Pugin
e01c1e0d37 Rename test. 2017-08-29 14:34:35 +03:00
Egor Pugin
c2602e86e9 Make counter 64 bits. 2017-08-29 14:20:51 +03:00
Egor Pugin
e2a2a57820 Fix multithreaded async pipes creation. 2017-08-29 14:19:21 +03:00
Klemens Morgenstern
547c04fc1f Updated vfork check 2017-08-22 22:02:48 +02:00
Klemens Morgenstern
6ab2ed1723 Merge pull request #119 from klemens-morgenstern/fix_for_118
Strange typo fix
2017-08-22 15:50:58 -04:00
Klemens Morgenstern
79e26878b1 Strange typo fix
Trying to fix #118
2017-08-22 18:24:53 +02:00
Klemens Morgenstern
d15e7be16a Merge pull request #117 from sehe/develop
fix `rdbuf()` implementation on pipe
2017-08-22 15:40:57 +02:00
sehe
3ab038fc0f fix rdbuf() implementation on pipe 2017-08-22 09:56:44 +02:00
Klemens Morgenstern
66989a25f2 Update wait_group.hpp 2017-08-02 22:23:09 +02:00
klemens-morgenstern
c748fff766 Merge branch 'master' of github.com:boostorg/process 2017-08-02 21:59:29 +02:00
Klemens Morgenstern
4772a08f89 Merge pull request #113 from klemens-morgenstern/develop
1.65 bugfixes
2017-08-02 21:58:22 +02:00
klemens-morgenstern
054d7980ab hopefully closes #106 2017-08-02 21:08:33 +02:00
Klemens Morgenstern
4c6b0fff2a Merge pull request #115 from klemens-morgenstern/sigchld_service
Sigchld service
2017-08-02 13:50:09 +02:00
Klemens Morgenstern
449eef0b98 Update async.hpp 2017-08-02 09:37:06 +02:00
Klemens Morgenstern
3992965359 Update extend.qbk 2017-08-02 09:36:53 +02:00
Klemens Morgenstern
264b517b38 Update async.hpp 2017-08-02 09:35:41 +02:00
Klemens Morgenstern
71c2fad8ce Update extend.qbk 2017-08-02 09:33:36 +02:00
Klemens Morgenstern
5b45fad163 Update wait.cpp
removed double wait
2017-08-02 09:27:38 +02:00
Klemens Morgenstern
e899189bf4 Update on_exit3.cpp
typo fix
2017-08-02 09:25:39 +02:00
klemens-morgenstern
241883c9e4 changed to use only one signal 2017-08-02 08:34:53 +02:00
klemens-morgenstern
aeee4e5dbb windows wait_for fix 2017-08-02 08:31:30 +02:00
Klemens David Morgenstern
e08e095fd1 WEXITSTATUS fix 2017-08-02 01:52:58 -04:00
Klemens David Morgenstern
da34b4020d Trying to get the sigchld-service to work 2017-08-01 18:41:55 -04:00
Klemens David Morgenstern
99001ccb50 Fixed wait_for & wait_until, closes #11 2017-08-01 18:00:44 -04:00
klemens-morgenstern
f402f48138 started on sigchld_service.hpp 2017-08-01 20:58:09 +02:00
klemens-morgenstern
1960360099 typo fixes 2017-08-01 20:07:22 +02:00
klemens-morgenstern
83019b5f70 started on the wait for fix for posix 2017-08-01 19:35:55 +02:00
klemens-morgenstern
76418ca191 added wait_for and wait_until tests 2017-08-01 19:17:28 +02:00
klemens-morgenstern
f02e72304f seperated test-suites into valgrind / no-valgrind 2017-08-01 19:05:40 +02:00
klemens-morgenstern
4850ae493f Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2017-07-31 22:32:29 +02:00
Klemens Morgenstern
77aecb43b8 Merge pull request #14 from jschueller/lowercase-windows-header
lowercase win32 header to fix cross-compilation
2017-07-31 22:31:37 +02:00
Julien Schueller
66e576806f lowercase win32 header to fix cross-compilation 2017-07-31 22:27:39 +02:00
Klemens Morgenstern
15445fd2bf Merge pull request #110 from thomasschaub/develop
Respect WIFSIGNALED in all relevant places
2017-07-25 20:27:13 +02:00
Klemens Morgenstern
6f49261c6e Merge pull request #111 from thomasschaub/feature/avoid-reencoding-on-windows
Avoid string charset conversion
2017-07-25 20:24:15 +02:00
Thomas Schaub
062b26e046 Avoid string charset conversion 2017-07-25 18:12:13 +02:00
Thomas Schaub
bb0fe86292 Respect WIFSIGNALED in all relevant places
Was only respected for one `waitpid` call
2017-07-25 18:01:53 +02:00
Klemens Morgenstern
a3d3a98d5b Merge pull request #13 from egorpugin/develop
Set correct access rights. Fix windows build.
2017-07-24 07:23:23 +02:00
Egor Pugin
950f16fe42 Merge branch 'develop' of github.com-egorpugin:egorpugin/process into develop 2017-07-24 00:48:37 +03:00
Egor Pugin
225b322e56 Fix windows build. 2017-07-24 00:47:48 +03:00
Egor Pugin
3e31d43d61 Fix access rights. 2017-07-24 00:27:17 +03:00
Klemens Morgenstern
085adc07ec Merge pull request #12 from egorpugin/develop
Fix incorrect on_exit() callback called on any child exited.
2017-07-23 23:18:39 +02:00
Klemens Morgenstern
6aaefedf25 Merge pull request #11 from thomasschaub/develop
Respect WIFSIGNALED
2017-07-23 23:18:16 +02:00
Egor Pugin
8df9c467e5 Fix incorrect on_exit() callback called on any child exited. 2017-07-24 00:10:30 +03:00
Thomas Schaub
529d09f43b Respect WIFSIGNALED 2017-07-19 12:00:44 +02:00
klemens-morgenstern
ce2a06f3a6 closes #102 2017-06-03 10:29:45 +02:00
Klemens Morgenstern
93a077e911 Merge pull request #10 from triccardi-systran/typos
Fix some typos.
2017-05-22 11:24:35 +02:00
Thomas Riccardi
9ed2ebef27 Fix some typos. 2017-05-22 11:14:29 +02:00
klemens-morgenstern
7882bad799 updated readme 2017-05-10 15:00:55 +02:00
Klemens Morgenstern
92e1e04ae4 Merge pull request #9 from cdglove/restore_wargs_tests
Restore wargs tests
2017-05-10 14:59:31 +02:00
Chris Glover
cf19c451fa Remove returns that were disabling wargs tests. 2017-05-10 08:51:31 -04:00
klemens-morgenstern
74dd6570e3 small fixes, closes #97 2017-05-07 12:44:38 +02:00
klemens-morgenstern
826177a12e Merge branch 'develop' of github.com:boostorg/process into develop
# Conflicts:
#	include/boost/process/detail/windows/search_path.hpp
2017-05-01 10:56:24 +02:00
Klemens Morgenstern
6712c54827 Merge pull request #8 from tabe/throw_last_error-const_char
Overloading boost::process::detail::throw_last_error() for Xcode's clang++
2017-05-01 10:54:32 +02:00
Takeshi Abe
6a64b9e0bd Allow const char * as throw_last_error()'s argument 2017-05-01 17:29:35 +09:00
klemens-morgenstern
34377ecad0 typo fixes 2017-04-25 21:02:16 +02:00
klemens-morgenstern
ae2b0a9024 removed tabs 2017-04-23 19:16:39 +02:00
klemens-morgenstern
712ebf772b changed search_path to use PATHEXT on windows, closes #91 2017-04-23 19:14:18 +02:00
klemens-morgenstern
7a99be71d3 tab fix 2017-04-23 17:46:18 +02:00
klemens-morgenstern
210efd8dc5 Merge branch 'async-pipe-fix' into develop 2017-04-23 17:43:42 +02:00
klemens-morgenstern
ed15395f6d fixed example error, closes #87 2017-04-23 17:42:02 +02:00
klemens-morgenstern
05443af621 readme fix 2017-04-23 17:30:36 +02:00
klemens-morgenstern
a25665aeff removed merge error 2017-04-23 17:29:12 +02:00
klemens-morgenstern
ee4428c226 Merge branch 'whitespaces' into develop
# Conflicts:
#	include/boost/process/io.hpp
2017-04-23 17:28:35 +02:00
klemens-morgenstern
74814e46c1 closes #90 2017-04-23 15:09:39 +02:00
klemens-morgenstern
f27898cdcd yml branch selection fix 2017-04-23 15:05:41 +02:00
klemens-morgenstern
007dd97486 added pid_t typedef, closes #82 2017-04-23 15:03:50 +02:00
klemens-morgenstern
f0082aa797 closes #89 2017-04-23 14:54:46 +02:00
klemens-morgenstern
ba14d9f870 Normalize all the line endings 2017-04-23 14:48:16 +02:00
klemens-morgenstern
684f9bcf11 added .git attributes, see #88 2017-04-23 14:41:26 +02:00
Klemens Morgenstern
51735a5640 Merge pull request #86 from ForNeVeR/patch-1
README: update markdown
2017-04-06 08:53:09 +02:00
Friedrich von Never
d6b242c54a README: update markdown 2017-04-06 11:46:24 +07:00
Klemens Morgenstern
4075371cbe Merge pull request #3 from boostorg/develop
extension adding fix for windows
2017-04-05 11:32:27 +02:00
Klemens Morgenstern
d5d2c7b2ff Merge pull request #2 from krabicezpapundeklu/develop
Fix extension adding in "search_path" (Windows)
2017-04-05 11:31:55 +02:00
Jarda
1ac22670c7 Fix extension adding 2017-04-05 11:24:18 +02:00
Klemens Morgenstern
477a60ead3 Merge pull request #1 from boostorg/develop
Bugfixes 1.64 beta
2017-03-23 17:44:02 +01:00
Klemens Morgenstern
9daf3b4717 Merge pull request #80 from klemens-morgenstern/env_fix
Updated environment reset on windows
2017-03-19 18:36:51 +01:00
klemens-morgenstern
9cab8d455a Updated environment reset on windows 2017-03-19 18:04:38 +01:00
Klemens Morgenstern
f1bd81d56e Merge pull request #79 from ChrisKitching/moreWarnings
Fix some more warnings...
2017-03-17 19:13:24 +01:00
Chris Kitching
28dc0c8830 Repair more Wunused warnings 2017-03-17 17:39:33 +00:00
Chris Kitching
7e217fe012 Stop using mixed line-endings... 2017-03-17 17:39:05 +00:00
Klemens Morgenstern
04063ee076 compile fix for async_pipe 2017-03-16 20:19:25 +01:00
klemens-morgenstern
384e712912 added test file for async_pipe to repo 2017-03-16 16:57:42 +01:00
klemens-morgenstern
64bf929094 closes #78 2017-03-16 16:40:52 +01:00
klemens-morgenstern
18ab3ae8c1 fixed async_pipe to pipe conversion 2017-03-16 16:40:13 +01:00
klemens-morgenstern
6c63771ca9 fixed environment on windows 2017-03-16 12:18:47 +01:00
klemens-morgenstern
3a733827eb closes #74 2017-03-16 10:41:51 +01:00
klemens-morgenstern
226b3bd1fc added broken note to group 2017-03-16 10:19:24 +01:00
Klemens Morgenstern
158565dbef Merge pull request #76 from ChrisKitching/warnings
Silence a variety of warnings that spam users of the library
2017-03-16 10:18:01 +01:00
Klemens Morgenstern
a410059f6b Native environment fixes 2017-03-16 10:05:04 +01:00
Chris Kitching
3cf5cf49e3 Silence a Wmissing-braces warning 2017-03-15 17:09:27 +00:00
Chris Kitching
deb6af4b2b Suppress many Wunused warnings 2017-03-15 16:47:30 +00:00
Chris Kitching
b784a5b3cf Zero-initialise avoiding subelement bracing warnings 2017-03-15 16:34:49 +00:00
Chris Kitching
f74523503d Avoid unused-argument warning on Windows 2017-03-15 16:29:20 +00:00
Klemens Morgenstern
41ead2a2d6 Merge pull request #71 from andrejnau/fix_for_is_wchar_t
fix is_wchar_t<start_dir_init<wchar_t>>
2017-03-15 11:05:10 +01:00
Andrew Naumov
aa048edd69 fix is_wchar_t<start_dir_init<wchar_t>> 2017-03-14 22:49:10 +03:00
klemens-morgenstern
b15530152a added tests for environment (clear / erase) 2017-03-12 22:34:00 +01:00
klemens-morgenstern
3b4bf985f1 Merge branch 'develop' of github.com:klemens-morgenstern/boost-process into develop 2017-03-11 22:07:15 +01:00
klemens-morgenstern
d218ba7b48 added test for wchar_t conv & env.clear 2017-03-11 22:06:51 +01:00
Klemens Morgenstern
94f87c4615 Merge pull request #69 from andrejnau/add_conv_for_env
add char_converter for basic_environment
2017-03-11 22:06:07 +01:00
Klemens Morgenstern
99029b9cb7 Merge pull request #68 from andrejnau/fix_for_is_wchar_t
fix is_wchar_t<wchar_t*>
2017-03-11 22:02:25 +01:00
Andrew Naumov
ba5a6bfcf1 add char_converter for basic_environment 2017-03-11 23:10:54 +03:00
Andrew Naumov
054bdc47c1 fix is_wchar_t<wchar_t*> 2017-03-11 10:29:24 +03:00
klemens-morgenstern
6b433c8788 doc update 2017-03-02 14:16:38 +01:00
klemens-morgenstern
cf2a196d40 attempted fix for appveyor build 2017-03-02 01:12:35 +01:00
klemens-morgenstern
843e56ec1a minor cleanup 2017-03-02 00:16:05 +01:00
klemens-morgenstern
e4a00c9545 fixed cmd_test for windows 2017-03-01 23:42:41 +01:00
Klemens Morgenstern
55b338ab7c Added test for cmd style 2017-03-01 22:58:50 +01:00
Klemens Morgenstern
f18b585740 Implemented and tested execvpe 2017-03-01 22:39:18 +01:00
klemens-morgenstern
87027b2176 typo fix 2017-03-01 16:22:54 +01:00
klemens-morgenstern
e4a3d459c5 changed string to native 2017-02-28 21:39:43 +01:00
klemens-morgenstern
4d6e802fca replaced tabs with spaces 2017-02-28 21:28:42 +01:00
klemens-morgenstern
2f6e83b4e4 type fix 2017-02-28 21:22:59 +01:00
klemens-morgenstern
da42203fef typo fix 2017-02-28 21:14:16 +01:00
klemens-morgenstern
87cbedccd8 changed to correct search_path function 2017-02-28 18:55:43 +01:00
klemens-morgenstern
d561667301 removed unneeded const 2017-02-28 18:53:42 +01:00
klemens-morgenstern
9cfab7e19c attempted const fix 2017-02-28 17:17:24 +01:00
klemens-morgenstern
4ca67407bb const fix 2017-02-27 12:39:57 +01:00
klemens-morgenstern
70dad97816 experimental execvpe 2017-02-27 12:04:00 +01:00
klemens-morgenstern
f14285e954 typo fix 2017-02-21 20:32:38 +01:00
Klemens Morgenstern
7c108c7540 Merge pull request #61 from klemens-morgenstern/exit-code-bugfix
Exit code bugfix
2017-02-21 18:17:30 +01:00
klemens-morgenstern
ed8ef66310 closes #60 2017-02-21 17:17:20 +01:00
Klemens Morgenstern
988515d8d7 Merge pull request #59 from andrejnau/fix-on_error
fix compile error for posix error handling
2017-02-21 15:28:52 +01:00
andrejnau
954ff35e3a fix compile error for posix error handling 2017-02-21 16:34:38 +03:00
klemens-morgenstern
389dd1adc1 Merge branch 'master' of github.com:klemens-morgenstern/boost-process 2017-02-20 22:15:09 +01:00
klemens-morgenstern
167981e273 Merge branch 'develop' 2017-02-20 22:14:49 +01:00
klemens-morgenstern
caa7348827 added search_path remark to documentation 2017-02-20 22:14:35 +01:00
Klemens Morgenstern
c529567a07 Merge pull request #57 from Flast/support/non-glibc
Better support for non Glibc environment.
2017-02-19 15:50:48 +01:00
Kohei Takahashi
8729f409f3 sighandler_t is glibc specific type. 2017-02-19 19:50:51 +09:00
Kohei Takahashi
4f46f43387 Include <features.h> only if it uses glibc. 2017-02-19 15:31:18 +09:00
klemens-morgenstern
a69e8d1ebe fixed clang error 2017-01-27 15:14:10 +01:00
klemens-morgenstern
94213f0312 fighting warnings 2017-01-27 15:12:01 +01:00
Klemens Morgenstern
22da39b201 Merge pull request #55 from klemens-morgenstern/develop
OSX fix
2017-01-26 15:07:14 +01:00
klemens-morgenstern
2a7f5bb66f fixed OSX build, thank to @marton78 2017-01-25 12:47:27 +01:00
klemens-morgenstern
237d5d929f Merge branch 'master' into develop 2017-01-22 15:31:28 +01:00
Klemens Morgenstern
6a497ea6a1 Merge pull request #54 from klemens-morgenstern/develop
merge into master
2017-01-22 15:29:54 +01:00
klemens-morgenstern
663fc69691 Merge remote-tracking branch 'remotes/origin/pipe-fix2' into develop 2017-01-22 15:05:46 +01:00
Klemens Morgenstern
2cb340fb6a Next attempt for OSX support 2017-01-22 14:55:59 +01:00
klemens-morgenstern
ed045434a4 closes #53 (obsolete documentation in search_path) 2017-01-22 12:40:00 +01:00
Klemens Morgenstern
4ce19ef57e Merge pull request #50 from klemens-morgenstern/pipe-fix2
Pipe fix2
2017-01-17 14:30:38 +01:00
Klemens Morgenstern
6525e639e2 Async_pipe assignment fix 2017-01-17 13:33:18 +01:00
klemens-morgenstern
f742bf4018 asyng pipe assign fix 2017-01-17 12:56:12 +01:00
klemens-morgenstern
7c3640d8c3 linux pipe-fix attempt 2017-01-17 12:33:52 +01:00
Klemens Morgenstern
30ebcfcda6 Modified delay values for test 2017-01-17 01:17:28 +01:00
klemens-morgenstern
fc601c2e31 added small test for clsoign stdin during run 2017-01-17 01:02:56 +01:00
klemens-morgenstern
d1ae99bd1b updated process/doc 2017-01-16 20:32:49 +01:00
klemens-morgenstern
1b0f0cf83e updated doc forwarding 2017-01-16 11:25:31 +01:00
klemens-morgenstern
5d47a29bfe fixed missing changes in index.html 2017-01-13 16:19:41 +01:00
klemens-morgenstern
bba7968f7a added index.html 2017-01-13 16:18:57 +01:00
klemens-morgenstern
ca1c83cee9 hopefully fixed the xml workaround 2017-01-13 10:44:58 +01:00
klemens-morgenstern
5e969baf6b added workaround for xml inclusion 2017-01-13 01:33:28 +01:00
klemens-morgenstern
684be37ad7 another travis try 2017-01-13 01:02:14 +01:00
klemens-morgenstern
17446449a3 travis test 2017-01-13 00:57:34 +01:00
klemens-morgenstern
6f61869867 updated CI files 2017-01-13 00:31:23 +01:00
klemens-morgenstern
ff1a090026 added targets for release doc 2017-01-12 20:11:04 +01:00
Klemens Morgenstern
029580c12e Update README.md 2016-12-05 22:16:35 +01:00
Klemens Morgenstern
0d98efe98a Merge pull request #45 from klemens-morgenstern/develop
Master update
2016-12-05 21:46:12 +01:00
Klemens Morgenstern
9db6449044 Merge pull request #43 from klemens-morgenstern/async_system
Async system
2016-12-05 21:20:05 +01:00
klemens-morgenstern
a7d861d806 system-test2 fix && tab to space change 2016-12-05 20:03:31 +01:00
klemens-morgenstern
1b737392d0 doc update - added a concepts section 2016-12-05 18:40:42 +01:00
klemens-morgenstern
db948e46cb doc update 2016-12-05 16:04:41 +01:00
klemens-morgenstern
56044b1140 another system_test2 fix 2016-12-05 13:15:55 +01:00
klemens-morgenstern
c0130038e7 changed /boost/program_options to static
hopefully fixes appveyor error
2016-12-05 12:52:12 +01:00
klemens-morgenstern
52ee999d41 removed unused variable & hopefully fixed system test 2016-12-05 12:31:56 +01:00
klemens-morgenstern
9c0699ff72 fixed implementation of async_pipe_in/out 2016-12-05 03:29:47 +01:00
Klemens Morgenstern
c492c099ce Fixed forward decl on posix 2016-12-05 02:49:59 +01:00
klemens-morgenstern
f2b6cad7ee nother async_pipe fix (multiple pipes) 2016-12-05 00:54:09 +01:00
klemens-morgenstern
176437d789 added workaround for system 2016-12-04 21:03:29 +01:00
Klemens Morgenstern
15c04af3c4 Fixed missing reassignment after close - Closes #22 2016-12-04 19:16:47 +01:00
Klemens Morgenstern
ad9d2ce14d Fixed async_handler on posix 2016-12-04 15:56:29 +01:00
klemens-morgenstern
4f0444a06b another typo fix 2016-12-04 15:16:20 +01:00
klemens-morgenstern
68b8685d8e posix/io_service_ref fix 2016-12-04 15:08:23 +01:00
klemens-morgenstern
35ed7fdcc0 workaround for async on posix 2016-12-04 14:58:11 +01:00
klemens-morgenstern
3edeb104f9 made vfork explicit target 2016-12-04 14:31:31 +01:00
klemens-morgenstern
e79c9d4322 removed valgrind and added vfork back in 2016-12-04 14:19:11 +01:00
klemens-morgenstern
f70f61ccd1 added experimental asnyc_system 2016-12-04 03:57:30 +01:00
Klemens Morgenstern
6e0754e942 Merge pull request #41 from klemens-morgenstern/extensions
worked in review results
2016-12-03 13:15:50 +01:00
klemens-morgenstern
9b8f6c4906 small doc fix 2016-12-03 02:17:10 +01:00
klemens-morgenstern
43fae9108d added documentation for the extensions 2016-12-03 02:11:09 +01:00
klemens-morgenstern
b6a3123f47 removed errornous added coverage data 2016-12-02 18:33:37 +01:00
klemens-morgenstern
fb73448cb7 added documentation for extend 2016-12-02 18:28:00 +01:00
klemens-morgenstern
8c7d82aa35 added doxygen stuff for extend.hpp 2016-11-30 01:52:41 +01:00
klemens-morgenstern
90f20addd7 removed unessecary statics 2016-11-30 01:17:14 +01:00
klemens-morgenstern
6c31f3b1a0 added extension check 2016-11-30 00:20:50 +01:00
klemens-morgenstern
c4ff1d2bef another posix typo fix 2016-11-29 00:22:31 +01:00
klemens-morgenstern
ac28e433a0 posix typo fix 2016-11-28 22:56:23 +01:00
klemens-morgenstern
cceb5bf702 added extensions 2016-11-28 20:41:00 +01:00
klemens-morgenstern
46191bc17e reenabled startup_info_ext 2016-11-08 00:54:18 +01:00
klemens-morgenstern
c893f6e627 simplified on_exit for windows 2016-11-07 00:30:26 +01:00
Klemens Morgenstern
162c23364d Merge pull request #32 from klemens-morgenstern/develop
Final update before review
2016-10-26 15:01:19 +02:00
Klemens Morgenstern
13fb61e21a Merge pull request #31 from klemens-morgenstern/develop
terminate fix
2016-10-22 16:45:12 +02:00
Klemens Morgenstern
0c183fb78f Merge pull request #29 from klemens-morgenstern/develop
Added rvalue qualification & documentation fixes
2016-10-20 22:50:33 +02:00
Klemens Morgenstern
e67bd43eb0 Merge pull request #25 from klemens-morgenstern/develop
updated to pre-review version
2016-10-18 14:06:15 +02:00
Klemens Morgenstern
c832c1443f Merge pull request #18 from klemens-morgenstern/develop
doc-  & bugfixes
2016-09-15 00:17:10 +02:00
Klemens Morgenstern
a39fb6d79f Merge pull request #12 from klemens-morgenstern/develop
process 0.6 beta
2016-07-18 13:43:44 +02:00
763 changed files with 34679 additions and 720625 deletions

75
.circleci/config.yml Normal file
View File

@@ -0,0 +1,75 @@
version: 2
jobs:
build:
environment:
- BOOST_LIBRARY=process
- CXX_STANDARD=gnu++11
docker:
- image: gcc:7
steps:
- checkout
- run:
name: Setting up Environment
command: |
echo 'export BOOST="$HOME/boost-local"' >> $BASH_ENV
if [ $CIRCLE_BRANCH = "master" ]; then
echo 'export BOOST_BRANCH="master"' >> $BASH_ENV;
else
echo 'export BOOST_BRANCH="develop"' >> $BASH_ENV;
fi
echo 'export BOOST_REMOVE="$BOOST/libs/$BOOST_LIBRARY"' >> $BASH_ENV
HOME_SED_=$(echo $HOME | sed -e 's/\//\\\//g')
echo 'export HOME_SED=$HOME_SED_' >> $BASH_ENV
- run:
name: install pre dependencies
command: |
apt-get update -yqq
apt-get install git curl valgrind -y
- run:
name: Initializing git repo for boost
command: |
git init $BOOST
cd $BOOST
echo Testing $BRANCH_TO_TEST
git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git
git fetch --depth=1
git checkout $BOOST_BRANCH
git submodule update --init --merge
git remote set-branches --add origin $BOOST_BRANCH
git pull --recurse-submodules
git submodule update --init
git checkout $BOOST_BRANCH
git submodule foreach "git reset --quiet --hard; git clean -fxd"
git reset --hard; git clean -fxd
git status
rm -rf $BOOST_REMOVE
mv $HOME/project $BOOST_REMOVE
- run:
name: Bootstrapping boost-build
command: |
cd $BOOST
./bootstrap.sh
./b2 headers
- run:
name: Building examples
command: |
cd $BOOST_REMOVE/example
../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" -sBOOST_BUILD_PATH=. | tee example.log || FAILED=1
sed -i -e "s/^..\/..\/..\/boost\/process\//\/root\/project\/include\/boost\/process\//gm" example.log
python <(curl -s https://report.ci/annotate.py) --tool gcc --name "Circle CI Gcc Build" --input example.log
exit $FAILED
- run:
name: Running Unit tests
command: |
cd $BOOST_REMOVE/test
../../../b2 -j2 with-valgrind address-model=64 architecture=x86 testing.launcher=valgrind valgrind=on toolset=gcc cxxflags="--coverage -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. | tee test.log || FAILED=1
../../../b2 -j2 without-valgrind address-model=64 architecture=x86 toolset=gcc cxxflags="--coverage -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. | tee no-valgrind.log || FAILED=1
sed -i -e "s/^..\/..\/..\/boost\/process\//\/root\/project\/include\/boost\/process\//gm" test.log
sed -i -e "s/^..\/..\/..\/boost\/process\//\/root\/project\/include\/boost\/process\//gm" no-valgrind.log
python <(curl -s https://report.ci/annotate.py) --tool gcc --input test.log
python <(curl -s https://report.ci/annotate.py) --tool gcc --input no-valgrind.log
bash <(curl -s https://codecov.io/bash) -x gcov > /dev/null || true
echo "BUILD_RESULT: $FAILED"
exit $FAILED

38
.drone.star Normal file
View File

@@ -0,0 +1,38 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright Rene Rivera 2020.
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
#
#
globalenv={'B2_CI_VERSION': '1', 'B2_VARIANT': 'release'}
linuxglobalimage="cppalliance/droneubuntu1804:1"
windowsglobalimage="cppalliance/dronevs2019"
def main(ctx):
return [
#freebsd_cxx("gcc 11 freebsd", "g++-11", buildtype="boost", buildscript="drone", freebsd_version="13.1", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,20', 'B2_LINKFLAGS': '-Wl,-rpath=/usr/local/lib/gcc11'}, globalenv=globalenv),
freebsd_cxx("clang 14 freebsd", "clang++-14", buildtype="boost", buildscript="drone", freebsd_version="13.1", environment={'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
linux_cxx("docs", "", packages="docbook docbook-xml docbook-xsl xsltproc libsaxonhe-java default-jre-headless flex libfl-dev bison unzip rsync", image="cppalliance/droneubuntu1804:1", buildtype="docs", buildscript="drone", environment={"COMMENT": "docs"}, globalenv=globalenv),
linux_cxx("asan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'asan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11', 'B2_ASAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'DRONE_EXTRA_PRIVILEGED': 'True', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv, privileged=True),
linux_cxx("ubsan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11', 'B2_UBSAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'B2_LINKFLAGS': '-fuse-ld=gold', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv),
#linux_cxx("gcc 11 arm64", "g++-11", packages="g++-11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={ 'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': '17ba079169m'}, arch="arm64", globalenv=globalenv),
linux_cxx("GCC 10, Debug + Coverage", "g++-10", packages="g++-10 libssl-dev libffi-dev binutils-gold gdb",
image="cppalliance/droneubuntu2004:1", buildtype="boost", buildscript="drone", environment={"GCOV": "gcov-10", "LCOV_VERSION": "1.15", "VARIANT": "process_coverage", "TOOLSET": "gcc", "COMPILER": "g++-10", "CXXSTD": "11", "DRONE_BEFORE_INSTALL" : "process_coverage", "CODECOV_TOKEN": {"from_secret": "codecov_token"}}, globalenv=globalenv, privileged=True),
# A set of jobs based on the earlier .travis.yml configuration:
linux_cxx("Default clang++ with libc++", "clang++-libc++", packages="libc++-dev", image="cppalliance/droneubuntu1604:1", buildtype="buildtype", buildscript="drone", environment={ "B2_TOOLSET": "clang-7", "B2_CXXSTD": "11", "VARIANT": "debug", "TOOLSET": "clang", "COMPILER": "clang++-libc++", "CXXSTD": "11", "CXX_FLAGS": "<cxxflags>-stdlib=libc++ <linkflags>-stdlib=libc++", "TRAVISCLANG" : "yes" }, globalenv=globalenv),
linux_cxx("Default g++", "g++", image="cppalliance/droneubuntu1604:1", buildtype="buildtype", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "gcc", "COMPILER": "g++", "CXXSTD": "11" }, globalenv=globalenv),
linux_cxx("Clang 3.8, UBasan", "clang++-3.8", packages="clang-3.8 libssl-dev", llvm_os="precise", llvm_ver="3.8", image="cppalliance/droneubuntu1604:1", buildtype="boost", buildscript="drone", environment={"VARIANT": "process_ubasan", "TOOLSET": "clang", "COMPILER": "clang++-3.8", "CXXSTD": "11", "UBSAN_OPTIONS": 'print_stacktrace=1', "DRONE_BEFORE_INSTALL": "UBasan" }, globalenv=globalenv),
linux_cxx("gcc 6", "g++-6", packages="g++-6", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-6', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': '902ba3cda1'}, globalenv=globalenv),
linux_cxx("clang 3.8", "clang++-3.8", packages="clang-3.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-3.8', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': '7b52009b64'}, globalenv=globalenv),
osx_cxx("clang", "g++", packages="", buildtype="boost", buildscript="drone", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '11,17', 'DRONE_JOB_UUID': '91032ad7bb'}, globalenv=globalenv),
linux_cxx("coverity", "g++", packages="", buildtype="coverity", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'Coverity Scan', 'B2_TOOLSET': 'clang', 'DRONE_JOB_UUID': '472b07b9fc'}, globalenv=globalenv),
windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.1", "CXXSTD": "11", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.3", "CXXSTD": "11", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
]
# from https://github.com/boostorg/boost-ci
load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx")

34
.drone/drone.bat Executable file
View File

@@ -0,0 +1,34 @@
@ECHO ON
setlocal enabledelayedexpansion
if "%DRONE_JOB_BUILDTYPE%" == "boost" (
echo '==================================> INSTALL'
git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1
cp -prf boost-ci-cloned/ci .
rm -rf boost-ci-cloned
REM source ci/travis/install.sh
REM The contents of install.sh below:
for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi
SET BOOST_CI_TARGET_BRANCH=%DRONE_COMMIT_BRANCH%
SET BOOST_CI_SRC_FOLDER=%cd%
call ci\common_install.bat
echo '==================================> COMPILE'
REM set B2_TARGETS=libs/!SELF!/test libs/!SELF!/example
set B2_TARGETS=libs/!SELF!/test
cd !BOOST_ROOT!
call bootstrap.bat
b2 headers
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% define=%DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/!SELF!/test libs/!SELF!/example -j3
) else if "%DRONE_JOB_BUILDTYPE%" == "standalone-windows" (
REM not used
)

199
.drone/drone.sh Executable file
View File

@@ -0,0 +1,199 @@
#!/bin/bash
# Copyright 2020 Rene Rivera, Sam Darwin
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
set -xe
export TRAVIS_BUILD_DIR=$(pwd)
export DRONE_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=$DRONE_BRANCH
export TRAVIS_EVENT_TYPE=$DRONE_BUILD_EVENT
export VCS_COMMIT_ID=$DRONE_COMMIT
export GIT_COMMIT=$DRONE_COMMIT
export REPO_NAME=$DRONE_REPO
export USER=$(whoami)
export CC=${CC:-gcc}
export PATH=~/.local/bin:/usr/local/bin:$PATH
common_install () {
git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1
cp -prf boost-ci-cloned/ci .
rm -rf boost-ci-cloned
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
unset -f cd
fi
export SELF=`basename $REPO_NAME`
export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH"
export BOOST_CI_SRC_FOLDER=$(pwd)
. ./ci/common_install.sh
}
if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
$BOOST_ROOT/libs/$SELF/ci/travis/build.sh
elif [ "$DRONE_JOB_BUILDTYPE" == "docs" ]; then
echo '==================================> INSTALL'
export SELF=`basename $REPO_NAME`
pwd
cd ..
mkdir -p $HOME/cache && cd $HOME/cache
if [ ! -d doxygen ]; then git clone -b 'Release_1_8_15' --depth 1 https://github.com/doxygen/doxygen.git && echo "not-cached" ; else echo "cached" ; fi
cd doxygen
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
cd build
sudo make install
cd ../..
if [ ! -f saxonhe.zip ]; then wget -O saxonhe.zip https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/SaxonHE9-9-1-4J.zip/download && echo "not-cached" ; else echo "cached" ; fi
unzip -o saxonhe.zip
sudo rm /usr/share/java/Saxon-HE.jar
sudo cp saxon9he.jar /usr/share/java/Saxon-HE.jar
cd ..
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root --depth 1
cd boost-root
export BOOST_ROOT=$(pwd)
git submodule update --init libs/context
git submodule update --init tools/boostbook
git submodule update --init tools/boostdep
git submodule update --init tools/docca
git submodule update --init tools/quickbook
rsync -av $TRAVIS_BUILD_DIR/ libs/$SELF
python tools/boostdep/depinst/depinst.py ../tools/quickbook
./bootstrap.sh
./b2 headers
echo '==================================> SCRIPT'
echo "using doxygen ; using boostbook ; using saxonhe ;" > tools/build/src/user-config.jam
./b2 -j3 libs/$SELF/doc//boostrelease
elif [ "$DRONE_JOB_BUILDTYPE" == "codecov" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
cd $BOOST_ROOT/libs/$SELF
ci/travis/codecov.sh
elif [ "$DRONE_JOB_BUILDTYPE" == "valgrind" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
cd $BOOST_ROOT/libs/$SELF
ci/travis/valgrind.sh
elif [ "$DRONE_JOB_BUILDTYPE" == "standalone" ]; then
echo '==================================> INSTALL'
# Installing cmake with apt-get, so not required here:
# pip install --user cmake
echo '==================================> SCRIPT'
export CXXFLAGS="-Wall -Wextra -Werror -std=c++17"
mkdir __build_17
cd __build_17
cmake -DBOOST_JSON_STANDALONE=1 ..
cmake --build .
ctest -V .
export CXXFLAGS="-Wall -Wextra -Werror -std=c++2a"
mkdir ../__build_2a
cd ../__build_2a
cmake -DBOOST_JSON_STANDALONE=1 ..
cmake --build .
ctest -V .
elif [ "$DRONE_JOB_BUILDTYPE" == "coverity" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
if [ $VARIANT = "process_valgrind" ];
then export USE_VALGRIND="testing.launcher=valgrind valgrind=on";
fi ;
if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$TRAVIS_BRANCH" = "develop" -o "$TRAVIS_BRANCH" = "master" \) -a \( "$DRONE_BUILD_EVENT" = "push" -o "$DRONE_BUILD_EVENT" = "cron" \) ] ; then
cd $BOOST_ROOT/libs/$SELF
ci/travis/coverity.sh
fi
elif [ "$DRONE_JOB_BUILDTYPE" == "cmake-superproject" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> COMPILE'
export CXXFLAGS="-Wall -Wextra -Werror"
mkdir __build_static
cd __build_static
cmake -DBOOST_ENABLE_CMAKE=1 -DBUILD_TESTING=ON -DBoost_VERBOSE=1 \
-DBOOST_INCLUDE_LIBRARIES=$SELF ..
cmake --build .
ctest --output-on-failure -R boost_$SELF
cd ..
mkdir __build_shared
cd __build_shared
cmake -DBOOST_ENABLE_CMAKE=1 -DBUILD_TESTING=ON -DBoost_VERBOSE=1 \
-DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON ..
cmake --build .
ctest --output-on-failure -R boost_$SELF
elif [ "$DRONE_JOB_BUILDTYPE" == "cmake1" ]; then
echo '==================================> INSTALL'
pip install --user cmake
echo '==================================> SCRIPT'
export SELF=`basename $REPO_NAME`
BOOST_BRANCH=develop && [ "$DRONE_BRANCH" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
mkdir -p libs/$SELF
cp -r $DRONE_BUILD_DIR/* libs/$SELF
# git submodule update --init tools/boostdep
git submodule update --init --recursive
cd libs/$SELF
../../../b2 -sBOOST_BUILD_PATH=.
../../../b2 $MULTITHREAD with-valgrind address-model=64 architecture=x86 $USE_VALGRIND toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI
../../../b2 $MULTITHREAD without-valgrind address-model=64 architecture=x86 toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI
fi

96
.gitattributes vendored Normal file
View File

@@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile.v2 text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain

193
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,193 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- { toolset: gcc-5, cxxstd: "11,14,1z", os: ubuntu-latest, container: 'ubuntu:18.04', install: g++-5 }
- { toolset: gcc-6, cxxstd: "11,14,1z", os: ubuntu-latest, container: 'ubuntu:18.04', install: g++-6 }
- { toolset: gcc-7, cxxstd: "11,14,17", os: ubuntu-20.04, install: g++-7 }
- { toolset: gcc-10, cxxstd: "11,14,17,2a", os: ubuntu-22.04, install: g++-10 }
- { toolset: gcc-12, cxxstd: "11,14,17,20,2b", os: ubuntu-22.04, install: g++-12 }
- { toolset: clang, compiler: clang++-3.9, cxxstd: "11,14", os: ubuntu-latest, container: 'ubuntu:18.04', install: clang-3.9 }
- { toolset: clang, compiler: clang++-4.0, cxxstd: "11,14", os: ubuntu-latest, container: 'ubuntu:18.04', install: clang-4.0 }
- { toolset: clang, compiler: clang++-5.0, cxxstd: "11,14,1z", os: ubuntu-latest, container: 'ubuntu:18.04', install: clang-5.0 }
- { toolset: clang, compiler: clang++-6.0, cxxstd: "11,14,17", os: ubuntu-20.04, install: clang-6.0 }
- { toolset: clang, compiler: clang++-7, cxxstd: "11,14,17", os: ubuntu-20.04, install: clang-7 }
- { toolset: clang, compiler: clang++-8, cxxstd: "11,14,17", os: ubuntu-20.04, install: clang-8 }
- { toolset: clang, compiler: clang++-9, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-9 }
- { toolset: clang, compiler: clang++-10, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-10 }
- { toolset: clang, compiler: clang++-11, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-11 }
- { toolset: clang, compiler: clang++-12, cxxstd: "11,14,17,2a", os: ubuntu-20.04, install: clang-12 }
- { toolset: clang, compiler: clang++-13, cxxstd: "11,14,17,20,2b", os: ubuntu-22.04, install: clang-13 }
- { toolset: clang, compiler: clang++-14, cxxstd: "11,14,17,20,2b", os: ubuntu-22.04, install: clang-14 }
- { toolset: clang, cxxstd: "11,14,17,2a", os: macos-13 }
runs-on: ${{matrix.os}}
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
steps:
- name: Setup container environment
if: matrix.container
run: |
apt-get update
apt-get -y install sudo python3 git g++ curl
if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then
# Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590
curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217
fi
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
./bootstrap.sh
./b2 -d0 headers
- name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
- name: Run tests
run: |
cd ../boost-root
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release
alpine-linux:
runs-on: ubuntu-latest
container:
image: alpine:3.20.1
steps:
- name: Install packages
run: apk add g++ git python3 linux-headers
- uses: actions/checkout@v4
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
./bootstrap.sh
./b2 -d0 headers
- name: Run tests
run: |
cd ../boost-root
./b2 -j3 libs/$LIBRARY/test toolset=gcc cxxstd=23 variant=debug,release
windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.0
cxxstd: "14,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: gcc
cxxstd: "11,14,17,2a"
addrmd: 64
os: windows-2019
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker

1
.gitignore vendored
View File

@@ -31,4 +31,5 @@
/notes.cpp
/notes_p.txt
.settings
.DS_Store

View File

@@ -10,28 +10,6 @@
#
# File revision #6
env:
global:
# Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=$TRAVIS_BRANCH
# or just directly specify it
- BRANCH_TO_TEST=$TRAVIS_BRANCH
# Files, which coverage results must be ignored (files from other projects).
# Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
- IGNORE_COVERAGE=''
# Explicitly remove the following library from Boost. This may be usefull, if you're for example running Travis
# from `Boost.DLL` repo, while Boost already has `dll`.
#
# By default is eaual to - BOOST_REMOVE=`basename $TRAVIS_BUILD_DIR`
# This will force to use local repo content, instead of the Boost's default
# not needed because process is not yet in boost.
#- BOOST_REMOVE=process
matrix:
- CXX_STANDARD=c++11 TOOLSET=gcc-5
- CXX_STANDARD=c++1y TOOLSET=gcc-5
###############################################################################################################
# From this point and below code is same for all the Boost libs
@@ -39,80 +17,120 @@ env:
sudo: false
language: cpp
compiler:
- gcc
- gcc
os:
- linux
- linux
- osx
env:
matrix:
- BADGE=linux
- BADGE=osx
global:
# Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=$TRAVIS_BRANCH
# or just directly specify it
- BRANCH_TO_TEST=$TRAVIS_BRANCH
# Files, which coverage results must be ignored (files from other projects).
# Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
- IGNORE_COVERAGE=''
# Explicitly remove the following library from Boost. This may be usefull, if you're for example running Travis
# from `Boost.DLL` repo, while Boost already has `dll`.
#
# By default is eaual to - BOOST_REMOVE=`basename $TRAVIS_BUILD_DIR`
# This will force to use local repo content, instead of the Boost's default
# not needed because process is not yet in boost.
- BOOST_REMOVE=process
- CXX_STANDARD=gnu++11
matrix:
exclude:
- os: linux
env: BADGE=osx
- os: osx
env: BADGE=linux
# Installing additional tools
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- valgrind
- python-yaml
- gcc-5
- g++-5
# - lcov
- clang
- valgrind
- python-yaml
- gcc-5
- g++-5
# - lcov
- clang
before_install:
# Set this to the name of the library
- PROJECT_TO_TEST=`basename $TRAVIS_BUILD_DIR`
- echo "Testing $PROJECT_TO_TEST"
# Cloning Boost libraries (fast nondeep cloning)
- BOOST=$HOME/boost-local
- git init $BOOST
- cd $BOOST
- if [ $(BRANCH_TO_TEST) = "master" ]; then
BOOST_BRANCH=master;
else BOOST_BRANCH=develop; fi
- git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git
- git fetch --depth=1
- git checkout $BOOST_BRANCH
- git submodule update --init --merge
- git remote set-branches --add origin $BOOST_BRANCH
- git pull --recurse-submodules
- git submodule update --init
- git checkout $BOOST_BRANCH
- git submodule foreach "git reset --quiet --hard; git clean -fxd"
- git reset --hard; git clean -fxd
- git status
# - rm -rf $BOOST/libs/$BOOST_REMOVE
- mv $TRAVIS_BUILD_DIR/../$PROJECT_TO_TEST/ $BOOST/libs/$PROJECT_TO_TEST
- TRAVIS_BUILD_DIR=$BOOST/libs/$PROJECT_TO_TEST
- ./bootstrap.sh
- ./b2 headers
- cd $BOOST/libs/$PROJECT_TO_TEST/test
# Set this to the name of the library
- PROJECT_TO_TEST=`basename $TRAVIS_BUILD_DIR`
- echo "Testing $PROJECT_TO_TEST"
- if [ $TRAVIS_OS_NAME = "osx" ]; then brew install gcc5; brew install valgrind; brew install llvm; TOOLSET=clang; BOOST_TEST_CATCH_SYSTEM_ERRORS=no; MULTITHREAD=-j8; else TOOLSET=gcc-5; REPORT_CI=--boost-process-report-ci USE_VALGRIND="testing.launcher=valgrind valgrind=on"; fi
# Cloning Boost libraries (fast nondeep cloning)
- BOOST=$HOME/boost-local
- git init $BOOST
- cd $BOOST
- echo Branch to test $BRANCH_TO_TEST
- if [ $BRANCH_TO_TEST = "master" ]; then
BOOST_BRANCH=master;
else BOOST_BRANCH=develop; fi
- git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git
- git fetch --depth=1
- git checkout $BOOST_BRANCH
- git submodule update --init --merge
- git remote set-branches --add origin $BOOST_BRANCH
- git pull --recurse-submodules || true
- git submodule update --init
- git checkout $BOOST_BRANCH
- git submodule foreach "git reset --quiet --hard; git clean -fxd"
- git reset --hard; git clean -fxd
- git status
- echo "Removing $BOOST/libs/$BOOST_REMOVE"
- rm -rf $BOOST/libs/$BOOST_REMOVE
- mv $TRAVIS_BUILD_DIR/../$PROJECT_TO_TEST/ $BOOST/libs/$PROJECT_TO_TEST
- TRAVIS_BUILD_DIR=$BOOST/libs/$PROJECT_TO_TEST
- ./bootstrap.sh
- ./b2 headers
- cd $BOOST/libs/$PROJECT_TO_TEST/test
- echo BOOST_TEST_CATCH_SYSTEM_ERRORS $BOOST_TEST_CATCH_SYSTEM_ERRORS
script:
# `--coverage` flags required to generate coverage info for Coveralls
- ../../../b2 testing.launcher=valgrind address-model=64 architecture=x86 toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=.
# `--coverage` flags required to generate coverage info for Coveralls
- ../../../b2 $MULTITHREAD with-valgrind address-model=64 architecture=x86 $USE_VALGRIND toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI
- ../../../b2 $MULTITHREAD without-valgrind address-model=64 architecture=x86 toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI
after_success:
# Copying Coveralls data to a separate folder
- mkdir -p $TRAVIS_BUILD_DIR/coverals
- find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
- find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
# Copying Coveralls data to a separate folder
- mkdir -p $TRAVIS_BUILD_DIR/coverals
- find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
- find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
# Preparing Coveralls data by changind data format to a readable one
- git clone https://github.com/linux-test-project/lcov.git lcov_dir
- GCOV_VERSION=""
- if [[ "$TOOLSET" == *"-"* ]]; then GCOV_VERSION="--gcov-tool gcov-${TOOLSET#*-}"; fi
- LCOV="$BOOST/libs/$PROJECT_TO_TEST/test/lcov_dir/bin/lcov $GCOV_VERSION"
- $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory ./ --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
# Preparing Coveralls data by changind data format to a readable one
- git clone https://github.com/linux-test-project/lcov.git lcov_dir
- GCOV_VERSION=""
- if [[ "$TOOLSET" == *"-"* ]]; then GCOV_VERSION="--gcov-tool gcov-${TOOLSET#*-}"; fi
- LCOV="$BOOST/libs/$PROJECT_TO_TEST/test/lcov_dir/bin/lcov $GCOV_VERSION"
- $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory ./ --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
# ... erasing /test/ /example/ folder data
- cd $BOOST
- $LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "/usr*" "*/$PROJECT_TO_TEST/test/*" $IGNORE_COVERAGE "*/$PROJECT_TO_TEST/tests/*" "*/$PROJECT_TO_TEST/examples/*" "*/$PROJECT_TO_TEST/example/*" -o $TRAVIS_BUILD_DIR/coverals/coverage.info
# ... erasing /test/ /example/ folder data
- cd $BOOST
- $LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "*.cpp" "/usr*" "*/$PROJECT_TO_TEST/test/*" $IGNORE_COVERAGE "*/$PROJECT_TO_TEST/tests/*" "*/$PROJECT_TO_TEST/examples/*" "*/$PROJECT_TO_TEST/example/*" -o $TRAVIS_BUILD_DIR/coverals/coverage.info
# ... erasing data that is not related to this project directly
- OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$PROJECT_TO_TEST\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
- echo $OTHER_LIBS
- eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
# ... erasing data that is not related to this project directly
- OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/process\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
- echo $OTHER_LIBS
- eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info" > /dev/null
# Sending data to Coveralls
- cd $TRAVIS_BUILD_DIR
- gem install coveralls-lcov
- coveralls-lcov coverals/coverage.info
# Sending data to Coveralls
- cd $TRAVIS_BUILD_DIR
- gem install coveralls-lcov
- coveralls-lcov coverals/coverage.info
after_script:
- bash <(curl -s https://codecov.io/bash)
- cd $BOOST/libs/$PROJECT_TO_TEST/test
- curl -s https://report.ci/report.py | python - --name="$BADGE test run"

72
CMakeLists.txt Normal file
View File

@@ -0,0 +1,72 @@
# Generated by `boostdep --cmake process`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_process VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_process
src/detail/environment_posix.cpp
src/detail/environment_win.cpp
src/detail/last_error.cpp
src/detail/process_handle_windows.cpp
src/detail/throw_error.cpp
src/detail/utf8.cpp
src/ext/cmd.cpp
src/ext/cwd.cpp
src/ext/env.cpp
src/ext/exe.cpp
src/ext/proc_info.cpp
src/posix/close_handles.cpp
src/windows/default_launcher.cpp
src/environment.cpp
src/error.cpp
src/pid.cpp
src/shell.cpp)
add_library(Boost::process ALIAS boost_process)
target_include_directories(boost_process PUBLIC include)
target_link_libraries(boost_process
PUBLIC
Boost::algorithm
Boost::asio
Boost::config
Boost::core
Boost::filesystem
Boost::fusion
Boost::iterator
Boost::move
Boost::optional
Boost::system
Boost::tokenizer
Boost::type_index
Boost::winapi
)
target_compile_definitions(boost_process
PRIVATE BOOST_PROCESS_SOURCE=1
)
if (BOOST_PROCESS_USE_STD_FS)
target_compile_definitions(boost_process PUBLIC BOOST_PROCESS_USE_STD_FS=1 )
else()
target_link_libraries(boost_process PUBLIC Boost::filesystem)
endif()
if (WIN32)
target_link_libraries(boost_process PUBLIC ntdll shell32 advapi32 user32 ws2_32)
endif()
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_process PUBLIC BOOST_PROCESS_DYN_LINK)
else()
target_compile_definitions(boost_process PUBLIC BOOST_PROCESS_STATIC_LINK)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

View File

@@ -1,17 +1,21 @@
#[Boost Process (Boost.Process)](https://github.com/klemens-morgenstern/boost-process)
# [Boost Process (Boost.Process)](https://github.com/boostorg/process)
Boost.process is not yet part of the [Boost C++ Libraries](http://github.com/boostorg). It is a library for comfortable management of processes.
Boost.process is a library for comfortable management of processes, released with boost 1.64.0.
### Test results
Branches | Build | Tests coverage |
----------------|-------------- | -------------- |
Develop: | [![Build Status](https://travis-ci.org/klemens-morgenstern/boost-process.svg?branch=develop)](https://travis-ci.org/klemens-morgenstern/boost-process) [![Build status](https://ci.appveyor.com/api/projects/status/peup7e6m0e1bb5ba?svg=true)](https://ci.appveyor.com/project/klemens-morgenstern/boost-process) | [![Coverage Status](https://coveralls.io/repos/github/klemens-morgenstern/boost-process/badge.svg?branch=develop)](https://coveralls.io/github/klemens-morgenstern/boost-process?branch=develop) |
Master: | [![Build Status](https://travis-ci.org/klemens-morgenstern/boost-process.svg?branch=master)] (https://travis-ci.org/klemens-morgenstern/boost-process) [![Build status](https://ci.appveyor.com/api/projects/status/peup7e6m0e1bb5ba/branch/master?svg=true)](https://ci.appveyor.com/project/klemens-morgenstern/boost-process/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/klemens-morgenstern/boost-process/badge.svg?branch=master)](https://coveralls.io/github/klemens-morgenstern/boost-process?branch=master) |
| Branches | Linux / Windows | Code coverage | Matrix |
|----------|----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| Develop: | [![Build Status](https://drone.cpp.al/api/badges/boostorg/process/status.svg)](https://drone.cpp.al/boostorg/process) | [![codecov](https://codecov.io/gh/boostorg/process/branch/develop/graph/badge.svg?token=AhunMqTSpA)](https://codecov.io/gh/boostorg/process) | [![Matrix](https://img.shields.io/badge/matrix-develop-lightgray.svg)](http://www.boost.org/development/tests/develop/developer/process.html) |
| Master: | [![Build Status](https://drone.cpp.al/api/badges/boostorg/process/status.svg?ref=refs/heads/develop)](https://drone.cpp.al/boostorg/process) | [![codecov](https://codecov.io/gh/boostorg/process/branch/master/graph/badge.svg?token=AhunMqTSpA)](https://codecov.io/gh/boostorg/process) | [![Matrix](https://img.shields.io/badge/matrix-master-lightgray.svg)](http://www.boost.org/development/tests/master/developer/process.html) |
[Open Issues](https://github.com/klemens-morgenstern/boost-process/issues)
[Latest developer documentation](http://klemens-morgenstern.github.io/process/)
[Open Issues](https://github.com/boostorg/process/issues)
[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/process.html)
### About
This C++11 library is the current result of a long attempt to get a boost.process library, which is going on since 2006.
@@ -21,4 +25,4 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org
### Dependency
This library requires boost 1.63. Since this is not released yet you can clone the winapi module from [here](https://github.com/boostorg/winapi) to get it to work. You will need to overwrite the current code in boost/libs/winapi.
This library requires boost 1.64 with which it is released.

47
build.jam Normal file
View File

@@ -0,0 +1,47 @@
# Copyright René Ferdinand Rivera Morell 2024
# 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)
require-b2 5.2 ;
import feature : feature ;
feature boost.process.fs : boost std : optional propagated ;
feature boost.process.disable-close-range : on off : optional ;
constant boost_dependencies :
/boost/algorithm//boost_algorithm
/boost/asio//boost_asio
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/fusion//boost_fusion
/boost/io//boost_io
/boost/iterator//boost_iterator
/boost/move//boost_move
/boost/optional//boost_optional
/boost/system//boost_system
/boost/throw_exception//boost_throw_exception
/boost/tokenizer//boost_tokenizer
/boost/type_index//boost_type_index
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility
/boost/winapi//boost_winapi ;
project /boost/process
: common-requirements
<include>include
: default-build
<boost.process.fs>boost
;
explicit
[ alias boost_process : build//boost_process ]
[ alias all : boost_process example example/v2 test ]
;
call-if : boost-library process
: install boost_process
;

73
build/Jamfile Normal file
View File

@@ -0,0 +1,73 @@
# Copyright (c) 2024 Klemens D. Morgenstern
#
# 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)
import os ;
import feature ;
import-search /boost/config/checks ;
import config : requires ;
project : requirements
<define>BOOST_ASIO_NO_DEPRECATED
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
<toolset>msvc:<cxxflags>/bigobj
<target-os>windows:<define>WIN32_LEAN_AND_MEAN
<target-os>linux:<linkflags>-lpthread
: source-location ../src
: common-requirements
<library>$(boost_dependencies)
<boost.process.fs>std:<define>BOOST_PROCESS_USE_STD_FS=1
;
alias process_sources
: detail/environment_posix.cpp
detail/environment_win.cpp
detail/last_error.cpp
detail/process_handle_windows.cpp
detail/throw_error.cpp
detail/utf8.cpp
ext/cmd.cpp
ext/cwd.cpp
ext/env.cpp
ext/exe.cpp
ext/proc_info.cpp
posix/close_handles.cpp
windows/default_launcher.cpp
environment.cpp
error.cpp
pid.cpp
shell.cpp
;
lib shell32 ;
lib advapi32 ;
lib ntdll ;
lib user32 ;
lib ws2_32 ;
lib kvm ;
lib procstat ;
lib boost_process
: process_sources
: requirements <define>BOOST_PROCESS_SOURCE=1
<link>shared:<define>BOOST_PROCESS_DYN_LINK=1
<boost.process.fs>boost:<library>/boost/filesystem//boost_filesystem
<boost.process.disable-close-range>on:<define>BOOST_PROCESS_V2_POSIX_FORCE_DISABLE_CLOSE_RANGE=1
<target-os>windows:<library>shell32
<target-os>windows:<library>user32
<target-os>windows:<library>ntdll
<target-os>windows:<library>advapi32
<target-os>windows:<library>ws2_32
<target-os>bsd:<library>kvm
<target-os>freebsd:<library>kvm
<target-os>freebsd:<library>procstat
<target-os>netbsd:<library>kvm
<target-os>openbsd:<library>kvm
<target-os>solaris:<library>kvm
: usage-requirements
<link>shared:<define>BOOST_PROCESS_DYN_LINK=1
<boost.process.fs>boost:<library>/boost/filesystem//boost_filesystem
;

View File

@@ -1,31 +1,31 @@
# 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)
# Copyright 2022 Klemens D. Morgenstern
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
using boostbook ;
using quickbook ;
using doxygen ;
import asciidoctor ;
doxygen autodoc
:
../../../boost/process.hpp
[ glob ../../../boost/process/*.hpp ]
:
<doxygen:param>PREDEFINED=BOOST_PROCESS_DOXYGEN
<doxygen:param>HIDE_UNDOC_CLASSES=YES
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
;
html index.html : index.adoc ;
install html_ : index.html : <location>html ;
pdf process.pdf : index.adoc ;
explicit process.pdf ;
install pdf_ : process.pdf : <location>pdf ;
explicit pdf_ ;
install images
:
images/posix_exec_err.svg
images/posix_fork_err.svg
images/posix_success.svg
images/windows_exec.svg
:
<location>html/images
;
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : html_ ;
explicit boostrelease ;
boostbook standalone
:
process.qbk
:
<dependency>autodoc
<xsl:param>boost.root=../../../..
<xsl:param>html.stylesheet=../../../../doc/src/boostbook.css
;

View File

@@ -1,11 +1,13 @@
[section Acknowledgements]
= Acknowledgements
The first Boost.Process draft was created in 2006. A lof of people have worked on various drafts since then. Especially Merino Vidal, Ilya Sokolov and Felipe Tanus spent a lot of time working on early drafts. They influenced Boost.Process over the years and wrote code which, to various extents, is still around in the library today.
The design of earlier versions of Boost.Process was not always satisfying. In 2011 Jeff Flinn proposed the executor and initializer concepts Boost.Process is based on today. Without Jeff's idea the overall design of Boost.Process would not look like it does today.
A special thank you goes to [@http://www.intra2net.com/ Intra2net AG] (especially Thomas Jarosch) who sponsored a project to support the development of Boost.Process. It was this sponsorship which made it possible to create a new Boost.Process version in 2012.
A special thank you goes to [http://www.intra2net.com/(Intra2net AG) (especially Thomas Jarosch) who sponsored a project to support the development of Boost.Process. It was this sponsorship which made it possible to create a new Boost.Process version in 2012.
Great thanks also goes to Boris Schaeling, who despite having boost.process rejected, went on to work on it and maintained it up until this day and participated in the development of the current version.
[endsect]
Many Thanks, to [https://github.com/time-killer-games](Samuel Venable) for contributing the <<v2::ext>> functionality and all the research that went into it.

11
doc/configuration.adoc Normal file
View File

@@ -0,0 +1,11 @@
= Configuration
Boost process v2 can be configured in the following ways:
[cols="1,1"]
|===
| Macro | Description
| `BOOST_PROCESS_V2_STANDALONE` | Build boost.process for standalone asio
| `BOOST_PROCESS_USE_STD_FS` | Use std::filesystem instead of boost::filsystem
| `BOOST_PROCESS_V2_POSIX_FORCE_DISABLE_CLOSE_RANGE` | Disable usage of `close_range`.

View File

@@ -1,93 +0,0 @@
[section:design Design Rationale]
[section Scope]
This library is meant to give an wrapper around the different OS-specific methods
to launch processes. Its aim is to provide all functionality that is available on
those systems and allow the user to do all related things, which require using the OS APIs.
[*This library does not try to provide a full library for everything process related]
In many discussions the proposal was made to build boost.process into a DSEL [footnote Domain Specific Embedded Language] of some sort.
This is not the goal, it rather provides the facilities to build such a DSEL-Library on top of it.
Therefore the library also does [*not] force any particular use (such as only asynchronous communication) on its user.
It rather could be integrated with such a library.
[endsect]
[section Interface Style]
Boost.Process does use a very particular style when constructing a process.
This is because a process holds many properties, which are not members of the actual child class.
Those properties are in many cases not accessible by the father process, for example when using environments.
Here the child process can modify its own environment, but there is no way for the father process to know.
That means, that a child process has properties that cannot be accessed in C++.
This now leads to the two styles supported and mixed by this library. Overloading and properties.
Consider that you may want to launch a process passing a number of arguments. This is supported in both styles, and would look like this:
```
system("gcc", "--version"); //overloading
system("gcc", args={"--version"}); //property style.
```
Both styles can also be mixed in some cases.
```
system("gcc", "-c", args+={"main.cpp"});
```
In the following section the avaible styles will be described. Note that the
overload style is implemented via type traits, so the types will be listed.
[caution There is no guarantee in which order the arguments will be applied!
There is however a guarantee for arguments belonging together, i.e. the string
argument and the args property will be evaluated in the order given.]
[endsect]
[section:arg_cmd_style Arguments/Command Style]
When passing arguments to the process, two styles are provided, the cmd-style and the exe-/args-style.
The cmd style will interpret the string as a sequence of the exe and arguments and parse them as such, while the exe-/args-style will
interpret each string as an argument.
[table:id Cmd vs Exe/Args
[[String] [Cmd] [Exe/Args]]
[["gcc --version"] [{"gcc", "--version"}] [{"\\"gcc --version\\""}]]
]
When using the overloading variant, a single string will result in a cmd interpretation,
several strings will yield a exe-args interpretation. Both version can be set explicitly:
```
system("grep -c false /etc/passwd"); //cmd style
system("grep", "-c", "false", "/etc/passwd"); //exe-/args-
system(cmd="grep -c false /etc/passwd"); //cmd style
system(exe="grep", args={"-c", "false", "/etc/passwd"}); //exe-/args-
```
[note If a '"' sign is used in the argument style, it will be passed as part of the argument.
If the same effect it wanted with the cmd syntax, it ought to be escaped, i.e. '\\\"'. ]
[note On windows the path will only be searched for the executable in the command style.]
[endsect]
[section:plat_ext Extensions]
The simplest form to extend functionality is to provide another handler, which
will be called on the respective events on process launching. The names are:
*`boost::process::on_setup`
*`boost::process::on_error`
*`boost::process::on_success`
As an example:
```
child c("ls", on_setup([](){cout << "On Setup" << endl;});
```
[note On posix all those callbacks will be handled by this process, not the created one.
This is different for the posix extensions, which can be executed on the forked process.]
[endsect]
[endsect]

31
doc/env.adoc Normal file
View File

@@ -0,0 +1,31 @@
== Environment
The `environment` namespace provides all sorts of facilities to query and manipulate the environment of the current process.
The api should be straight forward, but one oddity that needs to be pointed out is, that environment names
are not case sensitive on windows. The key_traits class implements the proper traits depending on the current system.
Additionally, environment can be lists separated by `:` or `;`; `environment::value` and
`environment::value_view` can be used to iterate those.
Beyond that, the requirements on an environment are a low as possible;
an environment is either a list of strings or a list of string-pairs. It is however recommended to use the environment types,
as to have the right value comparisons.
To note is the `find_executable` functions, which searches in an environment for an executable.
.example/env.cpp:19-28
[source,cpp]
----
include::../example/env.cpp[tag=current_env]
----
== Subprocess environment
The subprocess environment assignment follows the same constraints:
.example/env.cpp:34-42
[source,cpp,ident=0]
----
include::../example/env.cpp[tag=subprocess_env]
----

View File

@@ -1,87 +0,0 @@
[section:faq Frequently Asked Questions]
[section:dead_lock Why does this produce a deadlock?]
Now let's revisit our c++filt example and we will put in an obvious mistake.
This might however be not as obvious for more complex applications.
```
vector<string> demangle(vector<string> in)
{
ipstream is;
opstream os;
child c("c++filt", std_out > is, std_in < os);
vector<string> data;
for (auto & elem : data)
{
string line;
getline(is, line);
os << elem;
}
}
```
We switched the read and write operation up, so that's causing a dead-lock.
This locks immediately. This is because `c++filt` expects input, before
outputting any data. The launching process on the other hand wait's for it's output.
[endsect]
[section:closep Why does the pipe not close?]
Now for another example, which might look correct, let's consider you want
to use `ls` to read the current directory.
```
ipstream is;
child c("ls", std_out > is);
std::string file;
while (is >> file)
cout << "File: " << file << endl;
```
This will also deadlock, because the pipe does not close when the subprocess exits.
So the `ipstream` will still look for data even though the process has ended.
[note It is not possible to use automatically pipe-closing in this library, because
a pipe might be a file-handle (as for async pipes on windows).]
But, since pipes are buffered, you might get incomplete data if you do this:
```
ipstream is;
child c("ls", std_out > is);
std::string file;
while (c.running())
{
is >> file;
cout << "File: " << file << endl;
}
```
It is therefore highly recommended that you use the asynchronous api if you are
not absolutely sure how the output will look.
[endsect]
[section:wchar_t When will the codecvt be used?]
Since windows does not use UTF-8 it is sometimes unavoidable to use the `wchar_t` version of the WinApi.
To keep this library consistent it provides `wchar_t` support on posix also.
Since the posix api is purely `char` every `wchar_t` based type will be converted into `char`.
Windows on the other hand is more selective; the default is to use `char`,
but if any parameter requires `wchar_t`, everything will be converted to `wchar_t`.
This also includes `boost::filesystem::path`. Additionally, if the system does not provide
the `char` api (as is the case with Windows CE) everything will also be converted.
[endsect]
[endsect]

118
doc/images/plantuml.txt Normal file
View File

@@ -0,0 +1,118 @@
Plantuml source file (for later edit)
// Style
skinparam backgroundColor #FFFFFF
skinparam sequence {
ActorBorderColor DeepSkyBlue
ArrowColor #4a6484
LifeLineBorderColor #4a6484
ParticipantBackgroundColor #91c6ff
ParticipantBorderColor black
BoxBorderColor black
}
//posix no error
/**
\plantuml
activate Father
box "Child Process" #LightGrey
participant Child
participant Exe
end box
Father->Father : on_setup
activate Father
deactivate Father
Father->Child : fork
activate Child
Father -> Father : wait for error
deactivate Father
Child->Child : on_exec_setup
activate Child
deactivate Child
Child->Exe : execve
deactivate Child
activate Father
activate Exe
Father -> Father : on_success
activate Father
deactivate Father
\endplantuml */
//posix exec error
/**
\plantuml
activate Father
Father->Father : on_setup
activate Father
deactivate Father
Father->Child : fork
activate Child
Father -> Father : wait for error
deactivate Father
Child->Child : on_exec_setup
activate Child
deactivate Child
Child->Child : execve
Child->Child : on_exec_error
activate Child
deactivate Child
Child->Father : report
deactivate Child
activate Father
Father -> Father : on_error
activate Father
deactivate Father
\endplantuml
//posix fork error
\plantuml
activate Father
Father->Father : on_setup
activate Father
deactivate Father
Father->Father : fork
Father -> Father : on_fork_error
activate Father
deactivate Father
Father -> Father : on_error
activate Father
deactivate Father
\endplantuml
//windows.
\plantuml
activate Father
Father->Father : on_setup
activate Father
deactivate Father
Father->Child : CreateProcess
activate Child
alt Successful Launch
Father -> Father : on_success
activate Father
deactivate Father
else Error during launch
Father -> Father : on_error
activate Father
deactivate Father
end
\endplantuml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="355px" preserveAspectRatio="none" style="width:142px;height:355px;" version="1.1" viewBox="0 0 142 355" width="142px" zoomAndPan="magnify"><defs><filter height="300%" id="f7wjnsf" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="259.5313" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="34" y="48.2969"/><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="28" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="39" y="77.2969"/><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="28" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="39" y="191.5625"/><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="28" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="39" y="263.6953"/><line style="stroke: #4A6484; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="39" x2="39" y1="38.2969" y2="316.8281"/><rect fill="#91C6FF" filter="url(#f7wjnsf)" height="30.2969" style="stroke: #000000; stroke-width: 1.5;" width="58" x="8" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="44" x="15" y="22.9951">Father</text><rect fill="#91C6FF" filter="url(#f7wjnsf)" height="30.2969" style="stroke: #000000; stroke-width: 1.5;" width="58" x="8" y="315.8281"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="44" x="15" y="335.8232">Father</text><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="259.5313" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="34" y="48.2969"/><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="28" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="39" y="77.2969"/><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="28" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="39" y="191.5625"/><rect fill="#FFFFFF" filter="url(#f7wjnsf)" height="28" style="stroke: #4A6484; stroke-width: 1.0;" width="10" x="39" y="263.6953"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="49" x2="91" y1="69.4297" y2="69.4297"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="91" x2="91" y1="69.4297" y2="82.4297"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="50" x2="91" y1="82.4297" y2="82.4297"/><polygon fill="#4A6484" points="60,78.4297,50,82.4297,60,86.4297,56,82.4297" style="stroke: #4A6484; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="59" x="56" y="64.3638">on_setup</text><line style="stroke: #4A6484; stroke-width: 1.0;" x1="44" x2="86" y1="141.5625" y2="141.5625"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="86" x2="86" y1="141.5625" y2="154.5625"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="45" x2="86" y1="154.5625" y2="154.5625"/><polygon fill="#4A6484" points="55,150.5625,45,154.5625,55,158.5625,51,154.5625" style="stroke: #4A6484; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="24" x="51" y="136.4966">fork</text><line style="stroke: #4A6484; stroke-width: 1.0;" x1="49" x2="91" y1="183.6953" y2="183.6953"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="91" x2="91" y1="183.6953" y2="196.6953"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="50" x2="91" y1="196.6953" y2="196.6953"/><polygon fill="#4A6484" points="60,192.6953,50,196.6953,60,200.6953,56,196.6953" style="stroke: #4A6484; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="85" x="56" y="178.6294">on_fork_error</text><line style="stroke: #4A6484; stroke-width: 1.0;" x1="49" x2="91" y1="255.8281" y2="255.8281"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="91" x2="91" y1="255.8281" y2="268.8281"/><line style="stroke: #4A6484; stroke-width: 1.0;" x1="50" x2="91" y1="268.8281" y2="268.8281"/><polygon fill="#4A6484" points="60,264.8281,50,268.8281,60,272.8281,56,268.8281" style="stroke: #4A6484; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="54" x="56" y="250.7622">on_error</text></g></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.5 KiB

51
doc/index.adoc Normal file
View File

@@ -0,0 +1,51 @@
= boost.process
Klemens Morgenstern <klemens.morgenstern@gmx.net>
Version 2.0, 19.11.2024
:source-highlighter: rouge
:toc: left
:toclevels: 4
:icons: font
:idprefix:
:docinfo: private-footer
:source-highlighter: rouge
:source-language: c++
:example-caption: Example
:imagesdir: ./images
:leveloffset: +1
include::quickstart.adoc[]
include::launcher.adoc[]
= Initializers
include::start_dir.adoc[]
include::stdio.adoc[]
include::env.adoc[]
= Reference
include::reference/bind_launcher.adoc[]
include::reference/cstring_ref.adoc[]
include::reference/default_launcher.adoc[]
include::reference/environment.adoc[]
include::reference/error.adoc[]
include::reference/execute.adoc[]
include::reference/exit_code.adoc[]
include::reference/ext.adoc[]
include::reference/pid.adoc[]
include::reference/popen.adoc[]
include::reference/process.adoc[]
include::reference/process_handle.adoc[]
include::reference/shell.adoc[]
include::reference/start_dir.adoc[]
include::reference/stdio.adoc[]
include::reference/ext.adoc[]
include::reference/posix/bind_fd.adoc[]
include::reference/windows/creation_flags.adoc[]
include::reference/windows/show_window.adoc[]
include::version2.adoc[]
include::acknowledgements.adoc[]

View File

@@ -1,24 +0,0 @@
[section:introduction Introduction]
Boost.Process is a library to manage system processes. It can be used to:
* create child processes
* setup streams for child processes
* communicate with child processes through streams (synchronously or asynchronously)
* wait for processes to exit (synchronously or asynchronously)
* terminate processes
Here's a simple example of how to start a program with Boost.Process:
[def ipstream [classref boost::process::ipstream ipstream]]
[def system [funcref boost::process::system system]]
[def std_out [globalref boost::process::std_out std_out]]
[def boost/process.hpp [headerref boost/process.hpp boost/process.hpp]]
[import ../example/intro.cpp]
[intro]
[caution This is not yet an official Boost C++ library. It wasn't reviewed and can't be downloaded from [@http://www.boost.org/ www.boost.org]. It is however the latest version of an ongoing effort to create a process management library for Boost. For now the library can be downloaded or cloned from here [@https://github.com/klemens-morgenstern/boost-process/tree/develop https://github.com/klemens-morgenstern/boost-process/tree/develop].]
[endsect]

126
doc/launcher.adoc Normal file
View File

@@ -0,0 +1,126 @@
= Launcher
The process creation is done by a process_launcher.
The constructor of `process` will use the default_launcher, which varies by system.
There are additional launcher available on most systems.
[cols="1,1,1,1"]
|===
|Name | Summary | Default on | Available on
|`windows::default_launcher` | `CreateProcessW` | windows |windows
|`windows::as_user_launcher` | `CreateProcessAsUserW` | |windows
|`windows::with_logon_launcher` | `CreateProcessWithLogonW` | |windows
|`windows::with_token_launcher` | `CreateProcessWithTokenW` | |windows
|`posix::default_launcher` | fork & an error pipe | most of posix |posix
|`posix::fork_and_forget` | fork without error pipe | |posix
|`posix::vfork_launcher` | vfork | |posix
|===
A launcher is invoked through the call operator.
[source,cpp]
----
auto l = windows::as_user_launcher((HANDLE)0xDEADBEEF);
asio::io_context ctx;
boost::system::error_code ec;
auto proc = l(ctx, ec, "C:\\User\\boost\\Downloads\\totally_not_a_virus.exe", {});
----
The launcher will call certain functions on the initializer if they're present, as documented below.
The initializer are used to modify the process behaviour.
== Linux Launchers
The default launchers on linux open an internal pipe to communicate errors that occur after forking back to the parent process.
NOTE: A pipe can be used if one end is open on the parent, the other on the child.
This allows the parents to select on his pipe-end to know if the child exited.
This can be prevented by using the `fork_and_forget_launcher`.
Alternatively, the `vfork_launcher` can report errors directly back to the parent process.
Thus some calls to the initializers occur after forking from the child process.
[source,cpp]
----
struct custom_initializer
{
// called before a call to fork. A returned error will cancel the launch.
template<typename Launcher>
error_code on_setup(Launcher & launcher, const filesystem::path &executable, const char * const * (&cmd_line));
// called for every initializer if an error occurred during setup or process creation
template<typename Launcher>
void on_error(Launcher & launcher, const filesystem::path &executable, const char * const * (&cmd_line),
const error_code & ec);
// called after successful process creation
template<typename Launcher>
void on_success(Launcher & launcher, const filesystem::path &executable, const char * const * (&cmd_line));
// called for every initializer if an error occurred when forking, in addition to on_error.
template<typename Launcher>
void on_fork_error(Launcher & launcher, const filesystem::path &executable, const char * const * (&cmd_line),
const error_code & ec);
// called before a call to execve. A returned error will cancel the launch. Called from the child process.
template<typename Launcher>
error_code on_exec_setup(Launcher & launcher, const filesystem::path &executable, const char * const * (&cmd_line));
// called after a failed call to execve from the child process.
template<typename Launcher>
void on_exec_error(Launcher & launcher, const filesystem::path &executable, const char * const * (&cmd_line));
};
----
The call sequence on success:
image::posix_success.svg[]
The call sequence when fork fails:
image::posix_fork_err.svg[]
The call sequence when exec fails:
image::posix_exec_err.svg[]
The launcher will close all non-whitelisted file descriptors after `on_exec_setup`.
== Windows Launchers
Windows launchers are pretty straight forward, they will call the following functions on the initializer if present.
[source,cpp]
----
struct custom_initializer
{
// called before a call to CreateProcess. A returned error will cancel the launch.
template<typename Launcher>
error_code on_setup(Launcher & launcher, const filesystem::path &executable, std::wstring &cmd_line);
// called for every initializer if an error occurred during setup or process creation
template<typename Launcher>
void on_error(Launcher & launcher, const filesystem::path &executable, std::wstring &cmd_line,
const error_code & ec);
// called after successful process creation
template<typename Launcher>
void on_success(Launcher & launcher, const filesystem::path &executable, std::wstring &cmd_line);
};
----
NTOE: All the additional launchers for windows inherit `default_launcher`.
The call sequence is as follows:
image::windows_exec.svg
'''

View File

@@ -1,19 +0,0 @@
[library Boost.Process
[quickbook 1.5]
[authors [Morgenstern, Klemens David]]
[copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 Julio M. Merino Vidal, Ilya Sokolov, Felipe Tanus, Jeff Flinn, Boris Schaeling, 2016 Klemens D. Morgenstern]
[id process]
[dirname process]
[license
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 introduction.qbk]
[include tutorial.qbk]
[include design.qbk]
[include faq.qbk]
[xinclude autodoc.xml]
[include acknowledgements.qbk]

104
doc/quickstart.adoc Normal file
View File

@@ -0,0 +1,104 @@
= Quickstart
A process needs four things to be launched:
* an asio execution_context / executor
* a path to an executable
* a list of arguments
* a variadic set of initializers
.example/quickstart.cpp:13-17
[source,cpp,indent=0]
----
include::../example/quickstart.cpp[tag=cp]
----
<1> The executor for the process handle
<2> The Path to the executable
<3> The argument list in the form of an `std::initializer_list`.
<4> Not additional initializers
The started process can then be awaited or terminated.
== Lifetime
If the process handle goes out of scope, it will terminate the subprocess.
You can prevent this, by calling `proc.detach()`; do however note that this
can lead to zombie processes.
A process that completed will deliver an exit-code,
which can be obtained by calling `.exit_code` on the exited process and which is
also returned from `.wait()`.
.example/quickstart.cpp:22-23
[source,cpp, indent=0]
----
include::../example/quickstart.cpp[tag=ls]
----
The normal exit-code is what the subprocess returned from `main`;
posix will however add additional information about the process.
This is called the `native_exit_code`.
The `.running()` function can be used to detect if the process is still active.
== Signalling the subprocess
The parent process can signal the subprocess demanding certain actions.
`.terminate` will cause the subprocess to exit immediately (`SIGKILL` on posix).
This is the only reliable & portable way to end a subprocess.
.example/quickstart.cpp:28-29
[source,cpp,indent=0]
----
include::../example/quickstart.cpp[tag=terminate]
----
`.request_exit` will ask the subprocess to shutdown (`SIGTERM` on posix),
which the subprocess might ignore.
.example/quickstart.cpp:34-36
[source,cpp]
----
include::../example/quickstart.cpp[tag=request_exit]
----
`.interrupt` will send an SIGINT to the subprocess, which a subprocess might
interpret as a signal for shutdown.
WARNING: interrupt requires the initializer `windows::create_new_process_group` to be set on windows
.example/quickstart.cpp:41-43
[source,cpp]
----
include::../example/quickstart.cpp[tag=interrupt]
----
[endsect]
[section:execute Execute functions]
Process v2 provides `execute` and `async_execute` functions that can be used for managed executions.
.example/quickstart.cpp:48
[source,cpp]
----
include::../example/quickstart.cpp[tag=execute]
----
The async version supports cancellation and will forward cancellation types as follows:
- `asio::cancellation_type::total` -> interrupt
- `asio::cancellation_type::partial` -> request_exit
- `asio::cancellation_type::terminal` -> terminate
.example/quickstart.cpp:53-56
[source,cpp]
----
include::../example/quickstart.cpp[tag=async_execute]
----
<1> After 10 seconds send a request_exit.
<2> After 20 seconds terminate

View File

@@ -0,0 +1,16 @@
== `bind_launcher.hpp`
The `bind_launcher` utlitities allow on the fly construction of a launcher with bound initializers.
[source,cpp]
----
// Creates a new launcher with the bound initializer.
template<typename Launcher, typename ... Init>
auto bind_launcher(Launcher && launcher, Init && ... init);
// Calls bind_launcher with the default_launcher as the first parameter.
// The new launcher with bound paramaters
template<typename ... Init>
auto bind_default_launcher(Init && ... init);
----

View File

@@ -0,0 +1,3 @@
== `cstring_ref.hpp`
The `cstring_ref` is a string-view like type that holds a null-terminated string.

View File

@@ -0,0 +1,22 @@
== `default_launcher.hpp`
[#default_launcher]
The `default_launcher` is the standard way of creating a process.
[source,cpp]
----
asio::io_context ctx;
process proc(ctx.get_executor(), "test", {});
// equivalent to
process prod = default_launcher()(ctx.get_executor(), "test", {});
----
It has four overloads:
[source,cpp]
----
(ExecutionContext &, filesystem::path, Args && args, Inits && ... inits) -> basic_process<typename ExecutionContext::executor_type>
(Executor &, filesystem::path, Args && args, Inits && ... inits) -> basic_process<Executor>;
(ExecutionContext &, error_code&, filesystem::path, Args && args, Inits && ... inits) -> basic_process<typename ExecutionContext::executor_type>;`
(Executor &, error_code&, filesystem::path, Args && args, Inits && ... inits) -> basic_process<Executor>
----

View File

@@ -0,0 +1,735 @@
== `environment.hpp`
[#environment]
=== `environment`
The `environment` header provides facilities to maniuplate the current environment and set it for new processes.
An environment is a a `range` of `T` fulfilling these requirements:
For `T value`
* - std::get<0>(value) must return a type comparable to `key_view`.
* - std::get<1>(value) must return a type convertible to `value_view`.
[source,cpp]
----
// Namespace for information and functions regarding the calling process.
namespace environment
{
// A char traits type that reflects the OS rules for string representing environment keys.
/* Can be an alias of std::char_traits. May only be defined for `char` and `wchar_t`.
*
* Windows treats keys as case-insensitive yet perserving. The char traits are made to reflect
* that behaviour.
*/
tempalte<typename Char>
using key_char_traits = implementation_defined ;
// A char traits type that reflects the OS rules for string representing environment values.
/* Can be an alias of std::char_traits. May only be defined for `char` and `wchar_t`.
*/
tempalte<typename Char>
using value_char_traits = implementation_defined ;
// The character type used by the environment. Either `char` or `wchar_t`.
using char_type = implementation_defined ;
// The equal character in an environment string used to separate key and value.
constexpr char_type equality_sign = implementation_defined;
// The delimiter in environemtn lists. Commonly used by the `PATH` variable.
constexpr char_type delimiter = implementation_defined;
// The native handle of an environment. Note that this can be an owning pointer and is generally not thread safe.
using native_handle = implementation_defined;
// A forward iterator over string_view used by a value or value_view to iterator through environments that are lists.
struct value_iterator;
// A view type for a key of an environment
struct key_view
{
using value_type = char_type;
using traits_type = key_char_traits<char_type>;
using string_view_type = basic_string_view<char_type, traits_type>;
using string_type = std::basic_string<char_type, key_char_traits<char_type>>;
key_view() noexcept = default;
key_view( const key_view& p ) = default;
key_view( key_view&& p ) noexcept = default;
template<typename Source>
key_view( const Source& source );
key_view( const char_type * p);
key_view( char_type * p);
~key_view() = default;
key_view& operator=( const key_view& p ) = default;
key_view& operator=( key_view&& p ) noexcept = default;
key_view& operator=( string_view_type source );
void swap( key_view& other ) noexcept;
string_view_type native() const noexcept;
operator string_view_type() const;
int compare( const key_view& p ) const noexcept;
int compare( string_view_type str ) const;
int compare( const value_type* s ) const;
template< class CharT, class Traits = std::char_traits<CharT>,
class Alloc = std::allocator<CharT> >
std::basic_string<CharT,Traits,Alloc>
basic_string( const Alloc& alloc = Alloc()) const;
std::string string() const;
std::wstring wstring() const;
string_type native_string() const;
friend bool operator==(key_view l, key_view r);
friend bool operator!=(key_view l, key_view r);
friend bool operator<=(key_view l, key_view r);
friend bool operator>=(key_view l, key_view r);
friend bool operator< (key_view l, key_view r);
friend bool operator> (key_view l, key_view r);
bool empty() const;
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const key_view& p );
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, key_view& p );
const value_type * data() const;
std::size_t size() const;
};
// A view for a value in an environment
struct value_view
{
using value_type = char_type;
using string_view_type = basic_cstring_ref<char_type, value_char_traits<char_type>>;
using string_type = std::basic_string<char_type, value_char_traits<char_type>>;
using traits_type = value_char_traits<char_type>;
value_view() noexcept = default;
value_view( const value_view& p ) = default;
value_view( value_view&& p ) noexcept = default;
template<typename Source>
value_view( const Source& source );
value_view( const char_type * p);
value_view( char_type * p);
~value_view() = default;
value_view& operator=( const value_view& p ) = default;
value_view& operator=( value_view&& p ) noexcept = default;
value_view& operator=( string_view_type source );
void swap( value_view& other ) noexcept;
string_view_type native() const noexcept ;
operator string_view_type() const;
operator typename string_view_type::string_view_type() const;
int compare( const value_view& p ) const noexcept;
int compare( string_view_type str ) const;
int compare( const value_type* s ) const;
template< class CharT, class Traits = std::char_traits<CharT>,
class Alloc = std::allocator<CharT> >
std::basic_string<CharT,Traits,Alloc>
basic_string( const Alloc& alloc = Alloc() ) const;
std::string string() const;
std::wstring wstring() const;
string_type native_string() const;
bool empty() const;
friend bool operator==(value_view l, value_view r);
friend bool operator!=(value_view l, value_view r);
friend bool operator<=(value_view l, value_view r);
friend bool operator>=(value_view l, value_view r);
friend bool operator< (value_view l, value_view r);
friend bool operator> (value_view l, value_view r);
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const value_view& p );
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, value_view& p );
value_iterator begin() const;
value_iterator end() const;
const char_type * c_str();
const value_type * data() const;
std::size_t size() const;
};
// A view for a key value pair in an environment
struct key_value_pair_view
{
using value_type = char_type;
using string_type = std::basic_string<char_type>;
using string_view_type = basic_cstring_ref<char_type>;
using traits_type = std::char_traits<char_type>;
key_value_pair_view() noexcept = default;
key_value_pair_view( const key_value_pair_view& p ) = default;
key_value_pair_view( key_value_pair_view&& p ) noexcept = default;
template<typename Source,
typename = typename std::enable_if<is_constructible<string_view_type, Source>::value>::type>
key_value_pair_view( const Source& source );
key_value_pair_view( const char_type * p);
key_value_pair_view( char_type * p);
~key_value_pair_view() = default;
key_value_pair_view& operator=( const key_value_pair_view& p ) = default;
key_value_pair_view& operator=( key_value_pair_view&& p ) noexcept = default;
void swap( key_value_pair_view& other ) noexcept;
string_view_type native() const noexcept;
operator string_view_type() const;
operator typename string_view_type::string_view_type() const;
int compare( key_value_pair_view p ) const noexcept;
int compare( const string_type& str ) const;
int compare( string_view_type str ) const;
int compare( const value_type* s ) const;
template< class CharT, class Traits = std::char_traits<CharT>, class Alloc = std::allocator<CharT> >
std::basic_string<CharT,Traits,Alloc>
basic_string( const Alloc& alloc = Alloc()) const;
std::string string() const;
std::wstring wstring() const;
string_type native_string() const;
bool empty() const;
key_view key() const;
value_view value() const;
friend bool operator==(key_value_pair_view l, key_value_pair_view r);
friend bool operator!=(key_value_pair_view l, key_value_pair_view r);
friend bool operator<=(key_value_pair_view l, key_value_pair_view r);
friend bool operator>=(key_value_pair_view l, key_value_pair_view r);
friend bool operator< (key_value_pair_view l, key_value_pair_view r);
friend bool operator> (key_value_pair_view l, key_value_pair_view r);
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const key_value_pair_view& p );
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, key_value_pair_view& p );
template<std::size_t Idx>
inline auto get() const -> typename conditional<Idx == 0u, key_view,
value_view>::type;
const value_type * c_str() const noexcept;
const value_type * data() const;
std::size_t size() const;
};
// Allow tuple-likg getters & structured bindings.
template<> key_view key_value_pair_view::get<0u>() const;
template<> value_view key_value_pair_view::get<1u>() const;
// A class representing a key within an environment.
struct key
{
using value_type = char_type;
using traits_type = key_char_traits<char_type>;
using string_type = std::basic_string<char_type, traits_type>;
using string_view_type = basic_string_view<char_type, traits_type>;
key();
key( const key& p ) = default;
key( key&& p ) noexcept = default;
key( const string_type& source );
key( string_type&& source );
key( const value_type * raw );
key( value_type * raw );
explicit key(key_view kv);
template< class Source >
key( const Source& source);
key(const typename conditional<is_same<value_type, char>::value, wchar_t, char>::type * raw);
template< class InputIt >
key( InputIt first, InputIt last);
~key() = default;
key& operator=( const key& p ) = default;
key& operator=( key&& p );
key& operator=( string_type&& source );
template< class Source >
key& operator=( const Source& source );
key& assign( string_type&& source );
template< class Source >
key& assign( const Source& source );
template< class InputIt >
key& assign( InputIt first, InputIt last );
void clear();
void swap( key& other ) noexcept;
const value_type* c_str() const noexcept;
const string_type& native() const noexcept;
string_view_type native_view() const noexcept;
operator string_type() const;
operator string_view_type() const;
int compare( const key& p ) const noexcept;
int compare( const string_type& str ) const;
int compare( string_view_type str ) const;
int compare( const value_type* s ) const;
template< class CharT, class Traits = std::char_traits<CharT>,
class Alloc = std::allocator<CharT> >
std::basic_string<CharT,Traits,Alloc>
basic_string( const Alloc& alloc = Alloc()) const;
std::string string() const;
std::wstring wstring() const;
const string_type & native_string() const;
bool empty() const;
friend bool operator==(const key & l, const key & r);
friend bool operator!=(const key & l, const key & r);
friend bool operator<=(const key & l, const key & r);
friend bool operator>=(const key & l, const key & r);
friend bool operator< (const key & l, const key & r);
friend bool operator> (const key & l, const key & r);
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const key& p );
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, key& p );
const value_type * data() const;
std::size_t size() const;
};
bool operator==(const value_view &, const value_view);
bool operator!=(const value_view &, const value_view);
bool operator<=(const value_view &, const value_view);
bool operator< (const value_view &, const value_view);
bool operator> (const value_view &, const value_view);
bool operator>=(const value_view &, const value_view);
struct value
{
using value_type = char_type;
using traits_type = value_char_traits<char_type>;
using string_type = std::basic_string<char_type, traits_type>;
using string_view_type = basic_cstring_ref<char_type, traits_type>;
value();
value( const value& p ) = default;
value( const string_type& source );
value( string_type&& source );
value( const value_type * raw );
value( value_type * raw );
explicit value(value_view kv);
template< class Source >
value( const Source& source );
value(const typename conditional<is_same<value_type, char>::value, wchar_t, char>::type * raw);
template< class InputIt >
value( InputIt first, InputIt last);
~value() = default;
value& operator=( const value& p ) = default;
value& operator=( value&& p );
value& operator=( string_type&& source );
template< class Source >
value& operator=( const Source& source );
value& assign( string_type&& source );
template< class Source >
value& assign( const Source& source );
template< class InputIt >
value& assign( InputIt first, InputIt last );
void push_back(const value & sv);
void clear() {value_.clear();}
void swap( value& other ) noexcept;
const value_type* c_str() const noexcept;
const string_type& native() const noexcept;
string_view_type native_view() const noexcept;
operator string_type() const;
operator string_view_type() const;
operator typename string_view_type::string_view_type() const;
int compare( const value& p ) const noexcept;
int compare( const string_type& str ) const;
int compare( string_view_type str ) const;
int compare( const value_type* s ) const;
template< class CharT, class Traits = std::char_traits<CharT>,
class Alloc = std::allocator<CharT> >
std::basic_string<CharT,Traits,Alloc>
basic_string( const Alloc& alloc = Alloc()) const;
std::string string() const;
std::wstring wstring() const;
const string_type & native_string() const;
bool empty() const;
friend bool operator==(const value & l, const value & r);
friend bool operator!=(const value & l, const value & r);
friend bool operator<=(const value & l, const value & r);
friend bool operator>=(const value & l, const value & r);
friend bool operator< (const value & l, const value & r);
friend bool operator> (const value & l, const value & r);
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const value& p );
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, value& p );
value_iterator begin() const;
value_iterator end() const;
const value_type * data() const;
std::size_t size() const;
};
bool operator==(const value_view &, const value_view);
bool operator!=(const value_view &, const value_view);
bool operator<=(const value_view &, const value_view);
bool operator< (const value_view &, const value_view);
bool operator> (const value_view &, const value_view);
bool operator>=(const value_view &, const value_view);
struct key_value_pair
{
using value_type = char_type;
using traits_type = std::char_traits<char_type>;
using string_type = std::basic_string<char_type>;
using string_view_type = basic_cstring_ref<char_type>;
key_value_pair()l
key_value_pair( const key_value_pair& p ) = default;
key_value_pair( key_value_pair&& p ) noexcept = default;
key_value_pair(key_view key, value_view value);
key_value_pair(key_view key, std::initializer_list<basic_string_view<char_type>> values);
key_value_pair( const string_type& source );
key_value_pair( string_type&& source );
key_value_pair( const value_type * raw );
key_value_pair( value_type * raw );
explicit key_value_pair(key_value_pair_view kv) : value_(kv.c_str()) {}
template< class Source >
key_value_pair( const Source& source);
template< typename Key,
typename Value >
key_value_pair(
const std::pair<Key, Value> & kv);
key_value_pair(const typename conditional<is_same<value_type, char>::value, wchar_t, char>::type * raw);
template< class InputIt , typename std::iterator_traits<InputIt>::iterator_category>
key_value_pair( InputIt first, InputIt last );
~key_value_pair() = default;
key_value_pair& operator=( const key_value_pair& p ) = default;
key_value_pair& operator=( key_value_pair&& p );
key_value_pair& operator=( string_type&& source );
template< class Source >
key_value_pair& operator=( const Source& source );
key_value_pair& assign( string_type&& source );
template< class Source >
key_value_pair& assign( const Source& source );
template< class InputIt >
key_value_pair& assign( InputIt first, InputIt last );
void clear();
void swap( key_value_pair& other ) noexcept;
const value_type* c_str() const noexcept;
const string_type& native() const noexcept;
string_view_type native_view() const noexcept;
operator string_type() const;
operator string_view_type() const;
operator typename string_view_type::string_view_type() const;
operator key_value_pair_view() const;
int compare( const key_value_pair& p ) const noexcept;
int compare( const string_type& str ) const;
int compare( string_view_type str ) const;
int compare( const value_type* s ) const;
template< class CharT, class Traits = std::char_traits<CharT>, class Alloc = std::allocator<CharT> >
std::basic_string<CharT,Traits,Alloc>
basic_string( const Alloc& alloc = Alloc() ) const;
std::string string() const {return basic_string<char>();}
std::wstring wstring() const {return basic_string<wchar_t>();}
const string_type & native_string() const;
friend bool operator==(const key_value_pair & l, const key_value_pair & r);
friend bool operator!=(const key_value_pair & l, const key_value_pair & r);
friend bool operator<=(const key_value_pair & l, const key_value_pair & r);
friend bool operator>=(const key_value_pair & l, const key_value_pair & r);
friend bool operator< (const key_value_pair & l, const key_value_pair & r);
friend bool operator> (const key_value_pair & l, const key_value_pair & r);
bool empty() const;
struct key_view key() const;
struct value_view value() const;
template< class CharT, class Traits >
friend std::basic_ostream<CharT,Traits>&
operator<<( std::basic_ostream<CharT,Traits>& os, const key_value_pair& p );
template< class CharT, class Traits >
friend std::basic_istream<CharT,Traits>&
operator>>( std::basic_istream<CharT,Traits>& is, key_value_pair& p );
const value_type * data() const;
std::size_t size() const;
template<std::size_t Idx>
inline auto get() const -> typename conditional<Idx == 0u,environment::key_view, environment::value_view>::type;
};
bool operator==(const key_value_pair_view &, const key_value_pair_view);
bool operator!=(const key_value_pair_view &, const key_value_pair_view);
bool operator<=(const key_value_pair_view &, const key_value_pair_view);
bool operator< (const key_value_pair_view &, const key_value_pair_view);
bool operator> (const key_value_pair_view &, const key_value_pair_view);
bool operator>=(const key_value_pair_view &, const key_value_pair_view);
// Allow tuple-likg getters & structured bindings.
template<>
key_view key_value_pair::get<0u>() const;
template<>
value_view key_value_pair::get<1u>() const;
// A view object for the current environment of this process.
/*
* The view might (windows) or might not (posix) be owning;
* if it owns it will deallocate the on destruction, like a unique_ptr.
*
* Note that accessing the environment in this way is not thread-safe.
*
* @code
*
* void dump_my_env(current_view env = current())
* {
* for (auto & [k, v] : env)
* std::cout << k.string() << " = " << v.string() << std::endl;
* }
*
* @endcode
*
*
*/
struct current_view
{
using native_handle_type = environment::native_handle_type;
using value_type = key_value_pair_view;
current_view() = default;
current_view(current_view && nt) = default;
native_handle_type native_handle() { return handle_.get(); }
struct iterator
{
using value_type = key_value_pair_view;
using difference_type = int;
using reference = key_value_pair_view;
using pointer = key_value_pair_view;
using iterator_category = std::forward_iterator_tag;
iterator() = default;
iterator(const iterator & ) = default;
iterator(const native_iterator &native_handle) : iterator_(native_handle) {}
iterator & operator++()
{
iterator_ = detail::next(iterator_);
return *this;
}
iterator operator++(int)
{
auto last = *this;
iterator_ = detail::next(iterator_);
return last;
}
key_value_pair_view operator*() const
{
return detail::dereference(iterator_);
}
friend bool operator==(const iterator & l, const iterator & r) {return l.iterator_ == r.iterator_;}
friend bool operator!=(const iterator & l, const iterator & r) {return l.iterator_ != r.iterator_;}
private:
environment::native_iterator iterator_;
};
iterator begin() const {return iterator(handle_.get());}
iterator end() const {return iterator(detail::find_end(handle_.get()));}
private:
std::unique_ptr<typename remove_pointer<native_handle_type>::type,
detail::native_handle_deleter> handle_{environment::detail::load_native_handle()};
};
// Obtain a handle to the current environment
inline current_view current() {return current_view();}
// Find the home folder in an environment-like type.
/*
* @param env The environment to search. Defaults to the current environment of this process
*
* The environment type passed in must be a range with value T that fulfills the following requirements:
*
* For `T value`
*
* - std::get<0>(value) must return a type comparable to `key_view`.
* - std::get<1>(value) must return a type convertible to filesystem::path.
*
* @return A filesystem::path to the home directory or an empty path if it cannot be found.
*
*/
template<typename Environment = current_view>
inline filesystem::path home(Environment && env = current());
// Find the executable `name` in an environment-like type.
template<typename Environment = current_view>
filesystem::path find_executable(BOOST_PROCESS_V2_NAMESPACE::filesystem::path name,
Environment && env = current());
// Get an environment variable from the current process.
value get(const key & k, error_code & ec);
value get(const key & k);
value get(basic_cstring_ref<char_type, key_char_traits<char_type>> k, error_code & ec);
value get(basic_cstring_ref<char_type, key_char_traits<char_type>> k);
value get(const char_type * c, error_code & ec);
value get(const char_type * c);
// Set an environment variable for the current process.
void set(const key & k, value_view vw, error_code & ec);
void set(const key & k, value_view vw);
void set(basic_cstring_ref<char_type, key_char_traits<char_type>> k, value_view vw, error_code & ec);
void set(basic_cstring_ref<char_type, key_char_traits<char_type>> k, value_view vw);
void set(const char_type * k, value_view vw, error_code & ec);
void set(const char_type * k, value_view vw);
template<typename Char>
void set(const key & k, const Char * vw, error_code & ec);
template<typename Char>
void set(const key & k, const Char * vw);
template<typename Char>
void set(basic_cstring_ref<char_type, key_char_traits<char_type>> k, const Char * vw, error_code & ec);
template<typename Char>
void set(basic_cstring_ref<char_type, key_char_traits<char_type>> k, const Char * vw);
template<typename Char>
void set(const char_type * k, const Char * vw, error_code & ec);
template<typename Char>
void set(const char_type * k, const Char * vw);
// Remove an environment variable from the current process.
void unset(const key & k, error_code & ec);
void unset(const key & k);
void unset(basic_cstring_ref<char_type, key_char_traits<char_type>> k, error_code & ec);
void unset(basic_cstring_ref<char_type, key_char_traits<char_type>> k);
void unset(const char_type * c, error_code & ec);
void unset(const char_type * c);
}
----
=== `process_environment`
In order to set the environment of a child process, `process_environment` can be used.
[source, cpp]
.This will set the environment in a subprocess:
----
process proc{executor, find_executable("printenv"), {"foo"}, process_environment{"foo=bar"}};
----
The environment initializer will persist it's state, so that it can
be used multiple times. Do however note the the Operating System is
allowed to modify the internal state.
[source,cpp]
----
auto exe = find_executable("printenv");
process_environment env = {"FOO=BAR", "BAR=FOO"};
process proc1(executor, exe, {"FOO"}, env);
process proc2(executor, exe, {"BAR"}, env);
----

36
doc/reference/error.adoc Normal file
View File

@@ -0,0 +1,36 @@
== `error.hpp`
[#error]
The error header provides two error categories:
[source,cpp]
----
// Errors used for utf8 <-> UCS-2 conversions.
enum utf8_conv_error
{
insufficient_buffer = 1,
invalid_character,
};
extern const error_category& get_utf8_category();
static const error_category& utf8_category = get_utf8_category();
extern const error_category& get_exit_code_category();
/// An error category that can be used to interpret exit codes of subprocesses.
static const error_category& exit_code_category = get_exit_code_category();
}
----
The `get_exit_code_category` can be used as follows:
[source,cpp]
----
void run_my_process(filesystem::path pt, error_code & ec)
{
process proc(pt, {});
proc.wait();
ec.assign(proc.native_exit_code(), error::get_exit_code_category());
}
----

View File

@@ -0,0 +1,33 @@
== `execute.hpp`
[#execute]
The execute header provides two error categories:
[source,cpp]
----
// Run a process and wait for it to complete.
template<typename Executor> int execute(basic_process<Executor> proc);
template<typename Executor> int execute(basic_process<Executor> proc, error_code & ec)
// Execute a process asynchronously
template<typename Executor = net::any_io_executor,
BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (error_code, int))
WaitHandler = net::default_completion_token_t<Executor>>
auto async_execute(basic_process<Executor> proc,
WaitHandler && handler = net::default_completion_token_t<Executor>());
----
The `async_execute` function asynchronously for a process to complete.
Cancelling the execution will signal the child process to exit
with the following interpretations:
- `cancellation_type::total` -> interrupt
- `cancellation_type::partial` -> request_exit
- `cancellation_type::terminal` -> terminate
It is to note that `async_execute` will use the lowest selected cancellation
type. A subprocess might ignore anything not terminal.

View File

@@ -0,0 +1,43 @@
== `exit_code.hpp`
[#exit_code]
The exit code header provides portable handles for exit codes.
[source,cpp]
----
// The native exit-code type, usually an integral value
/* The OS may have a value different from `int` to represent
* the exit codes of subprocesses. It might also
* contain additional information.
*/
typedef implementation_defined native_exit_code_type;
// Check if the native exit code indicates the process is still running
bool process_is_running(native_exit_code_type code);
// Obtain the portable part of the exit code, i.e. what the subprocess has returned from main.
int evaluate_exit_code(native_exit_code_type code);
// Helper to subsume an exit-code into an error_code if there's no actual error isn't set.
error_code check_exit_code(
error_code &ec, native_exit_code_type native_code,
const error_category & category = error::get_exit_code_category());
----
The `check_exit_code` can be used like this:
[source,cpp]
----
process proc{co_await this_coro::executor, "exit", {"1"}};
co_await proc.async_wait(
asio::deferred(
[&proc](error_code ec, int)
{
return asio::deferred.values(
check_exit_code(ec, proc.native_exit_code())
);
----

46
doc/reference/ext.adoc Normal file
View File

@@ -0,0 +1,46 @@
== `ext`
The headers in `process/ext` provides features to obtain information about third part processes.
[source,cpp]
----
// Get the cmd line used to launche the process
template<typename Executor>
shell cmd(basic_process_handle<Executor> & handle, error_code & ec);
template<typename Executor>
shell cmd(basic_process_handle<Executor> & handle);
shell cmd(pid_type pid, error_code & ec);
shell cmd(pid_type pid);
// Get the current working directory of the process.
template<typename Executor>
filesystem::path cwd(basic_process_handle<Executor> & handle, error_code & ec);
template<typename Executor>
filesystem::path cwd(basic_process_handle<Executor> & handle)
filesystem::path cwd(pid_type pid, error_code & ec);
filesystem::path cwd(pid_type pid);
// Get the current environment of the process.
template<typename Executor>
env_view cwd(basic_process_handle<Executor> & handle, error_code & ec);
template<typename Executor>
env_view cwd(basic_process_handle<Executor> & handle)
env_view env(pid_type pid, error_code & ec);
env_view env(pid_type pid);
// Get the executable of the process.
template<typename Executor>
filesystem::path exe(basic_process_handle<Executor> & handle, error_code & ec);
template<typename Executor>
filesystem::path exe(basic_process_handle<Executor> & handle)
filesystem::path exe(pid_type pid, error_code & ec);
filesystem::path exe(pid_type pid);
----
WARNING: The function may fail with "operation_not_supported" on some niche platforms.
NOTE: On windows overloads taking a `HANDLE` are also available.

23
doc/reference/pid.adoc Normal file
View File

@@ -0,0 +1,23 @@
== `pid.hpp`
[#pid]
[source,cpp]
----
//An integral type representing a process id.
typedef implementation_defined pid_type;
// Get the process id of the current process.
pid_type current_pid();
// List all available pids.
std::vector<pid_type> all_pids(boost::system::error_code & ec);
std::vector<pid_type> all_pids();
// return parent pid of pid.
pid_type parent_pid(pid_type pid, boost::system::error_code & ec);
pid_type parent_pid(pid_type pid);
// return child pids of pid.
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec);
std::vector<pid_type> child_pids(pid_type pid);
----

163
doc/reference/popen.adoc Normal file
View File

@@ -0,0 +1,163 @@
== `popen.hpp`
[#popen]
`popen` is a class that launches a process and connect stdin & stderr to pipes.
[source,cpp]
----
popen proc(executor, find_executable("addr2line"), {argv[0]});
asio::write(proc, asio::buffer("main\n"));
std::string line;
asio::read_until(proc, asio::dynamic_buffer(line), '\n');
----
[source,cpp]
----
// A subprocess with automatically assigned pipes.
template<typename Executor = net::any_io_executor>
struct basic_popen : basic_process<Executor>
{
// The executor of the process
using executor_type = Executor;
// Rebinds the popen type to another executor.
template <typename Executor1>
struct rebind_executor
{
// The pipe type when rebound to the specified executor.
typedef basic_popen<Executor1> other;
};
// Move construct a popen
basic_popen(basic_popen &&) = default;
// Move assign a popen
basic_popen& operator=(basic_popen &&) = default;
// Move construct a popen and change the executor type.
template<typename Executor1>
basic_popen(basic_popen<Executor1>&& lhs)
: basic_process<Executor>(std::move(lhs)),
stdin_(std::move(lhs.stdin_)), stdout_(std::move(lhs.stdout_))
{
}
// Create a closed process handle
explicit basic_popen(executor_type exec);
// Create a closed process handle
template <typename ExecutionContext>
explicit basic_popen(ExecutionContext & context);
// Construct a child from a property list and launch it using the default process launcher.
template<typename ... Inits>
explicit basic_popen(
executor_type executor,
const filesystem::path& exe,
std::initializer_list<string_view> args,
Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename Launcher, typename ... Inits>
explicit basic_popen(
Launcher && launcher,
executor_type executor,
const filesystem::path& exe,
std::initializer_list<string_view> args,
Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename Args, typename ... Inits>
explicit basic_popen(
executor_type executor,
const filesystem::path& exe,
Args&& args, Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename Launcher, typename Args, typename ... Inits>
explicit basic_popen(
Launcher && launcher,
executor_type executor,
const filesystem::path& exe,
Args&& args, Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename ExecutionContext, typename ... Inits>
explicit basic_popen(
ExecutionContext & context,
const filesystem::path& exe,
std::initializer_list<string_view> args,
Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename Launcher, typename ExecutionContext, typename ... Inits>
explicit basic_popen(
Launcher && launcher,
ExecutionContext & context,
const filesystem::path& exe,
std::initializer_list<string_view> args,
Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename ExecutionContext, typename Args, typename ... Inits>
explicit basic_popen(
ExecutionContext & context,
const filesystem::path& exe,
Args&& args, Inits&&... inits);
// Construct a child from a property list and launch it using the default process launcher.
template<typename Launcher, typename ExecutionContext, typename Args, typename ... Inits>
explicit basic_popen(
Launcher && launcher,
ExecutionContext & context,
const filesystem::path& exe,
Args&& args, Inits&&... inits);
// The type used for stdin on the parent process side.
using stdin_type = net::basic_writable_pipe<Executor>;
// The type used for stdout on the parent process side.
using stdout_type = net::basic_readable_pipe<Executor>;
// Get the stdin pipe.
// Get the stdout pipe.
// Get the stdin pipe.
stdin_type & get_stdin();
const stdin_type & get_stdin() const;
// Get the stdout pipe.
stdout_type & get_stdout();
const stdout_type & get_stdout() const;
// Write some data to the stdin pipe.
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers);
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers,
boost::system::error_code& ec);
// Start an asynchronous write.
template <typename ConstBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t))
WriteToken = net::default_completion_token_t<executor_type>>
auto async_write_some(const ConstBufferSequence& buffers,
WriteToken && token = net::default_completion_token_t<executor_type>());
// Read some data from the stdout pipe.
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers);
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers,
boost::system::error_code& ec)
// Start an asynchronous read. template <typename MutableBufferSequence,
BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t))
ReadToken = net::default_completion_token_t<executor_type>>
auto async_read_some(const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadToken) token
= net::default_completion_token_t<executor_type>());
};
// A popen object with the default executor.
using popen = basic_popen<>;
----

View File

@@ -0,0 +1,70 @@
== `posix/bind_fd.hpp`
`bind_fd` is a utility class to bind a file descriptor to an explicit file descriptor for the child process.
[source,cpp]
----
struct bind_fd
{
// Inherit file descriptor with the same value.
/*
* This will pass descriptor 42 as 42 to the child process:
* @code
* process p{"test", {}, posix::bind_fd(42)};
* @endcode
*/
bind_fd(int target);
// Inherit an asio io-object as a given file descriptor to the child process.
/*
* This will pass the tcp::socket, as 42 to the child process:
* @code
* extern tcp::socket sock;
* process p{"test", {}, posix::bind_fd(42, sock)};
* @endcode
*/
template<typename Stream>
bind_fd(int target, Stream && str);
// Inherit a `FILE` as a given file descriptor to the child process.
/* This will pass the given `FILE*`, as 42 to the child process:
process p{"test", {}, posix::bind_fd(42, stderr)};
*/
bind_fd(int target, FILE * f);
// Inherit a file descriptor with as a different value.
/* This will pass 24 as 42 to the child process:
process p{"test", {}, posix::bind_fd(42, 24)};
*/
bind_fd(int target, int fd):
// Inherit a null device as a set descriptor.
/* This will a null device as 42 to the child process:
process p{"test", {}, posix::bind_fd(42, nullptr)};
*/
bind_fd(int target, std::nullptr_t);
// Inherit a newly opened-file as a set descriptor.
/* This will pass a descriptor to "extra-output.txt" as 42 to the child process:
process p{"test", {}, posix::bind_fd(42, "extra-output.txt")};
*/
bind_fd(int target, const filesystem::path & pth, int flags = O_RDWR | O_CREAT);
};
----
Using `bind_fd` can be used to inherit file descriptors explicitly, because no unused one will be.
[source,cpp]
----
----

174
doc/reference/process.adoc Normal file
View File

@@ -0,0 +1,174 @@
== `process.hpp`
[#process]
[source,cpp]
----
// A class managing a subprocess
/* A `basic_process` object manages a subprocess; it tracks the status and exit-code,
* and will terminate the process on destruction if `detach` was not called.
*/
template<typename Executor = net::any_io_executor>
struct basic_process
{
// The executor of the process
using executor_type = Executor;
// Get the executor of the process
executor_type get_executor() {return process_handle_.get_executor();}
// The non-closing handle type
using handle_type = basic_process_handle<executor_type>;
// Get the underlying non-closing handle
handle_type & handle() { return process_handle_; }
// Get the underlying non-closing handle
const handle_type & handle() const { return process_handle_; }
// Provides access to underlying operating system facilities
using native_handle_type = typename handle_type::native_handle_type;
// Rebinds the process_handle to another executor.
template <typename Executor1>
struct rebind_executor
{
// The socket type when rebound to the specified executor.
typedef basic_process<Executor1> other;
};
/** An empty process is similar to a default constructed thread. It holds an empty
handle and is a place holder for a process that is to be launched later. */
basic_process() = default;
basic_process(const basic_process&) = delete;
basic_process& operator=(const basic_process&) = delete;
// Move construct the process. It will be detached from `lhs`.
basic_process(basic_process&& lhs) = default;
// Move assign a process. It will be detached from `lhs`.
basic_process& operator=(basic_process&& lhs) = default;
// Move construct and rebind the executor.
template<typename Executor1>
basic_process(basic_process<Executor1>&& lhs);
// Construct a child from a property list and launch it using the default launcher..
template<typename ... Inits>
explicit basic_process(
executor_type executor,
const filesystem::path& exe,
std::initializer_list<string_view> args,
Inits&&... inits);
// Construct a child from a property list and launch it using the default launcher..
template<typename Args, typename ... Inits>
explicit basic_process(
executor_type executor,
const filesystem::path& exe,
Args&& args, Inits&&... inits);
// Construct a child from a property list and launch it using the default launcher..
template<typename ExecutionContext, typename ... Inits>
explicit basic_process(
ExecutionContext & context,
const filesystem::path& exe,
std::initializer_list<string_view> args,
Inits&&... inits);
// Construct a child from a property list and launch it using the default launcher.
template<typename ExecutionContext, typename Args, typename ... Inits>
explicit basic_process(
ExecutionContext & context,
const filesystem::path&>::type exe,
Args&& args, Inits&&... inits);
// Attach to an existing process
explicit basic_process(executor_type exec, pid_type pid);
// Attach to an existing process and the internal handle
explicit basic_process(executor_type exec, pid_type pid, native_handle_type native_handle);
// Create an invalid handle
explicit basic_process(executor_type exec);
// Attach to an existing process
template <typename ExecutionContext>
explicit basic_process(ExecutionContext & context, pid_type pid);
// Attach to an existing process and the internal handle
template <typename ExecutionContext>
explicit basic_process(ExecutionContext & context, pid_type pid, native_handle_type native_handle);
// Create an invalid handle
template <typename ExecutionContext>
explicit basic_process(ExecutionContext & context);
// Destruct the handle and terminate the process if it wasn't detached.
~basic_process();
// Sends the process a signal to ask for an interrupt, which the process may interpret as a shutdown.
/** Maybe be ignored by the subprocess. */
void interrupt(error_code & ec);
void interrupt();
// Throwing @overload void interrupt()
// Sends the process a signal to ask for a graceful shutdown. Maybe be ignored by the subprocess.
void request_exit(error_code & ec);
void request_exit();
// Send the process a signal requesting it to stop. This may rely on undocumented functions.
void suspend(error_code &ec);
void suspend();
// Send the process a signal requesting it to resume. This may rely on undocumented functions.
void resume(error_code &ec);
void resume();
// Unconditionally terminates the process and stores the exit code in exit_status.
void terminate(error_code & ec);
void terminate();
// Waits for the process to exit, store the exit code internally and return it.
int wait(error_code & ec);
int wait();
// Detach the process.
handle_type detach();
// Get the native
native_handle_type native_handle() {return process_handle_.native_handle(); }
// Return the evaluated exit_code.
int exit_code() cons;
// Get the id of the process;
pid_type id() const;
// The native handle of the process.
/** This might be undefined on posix systems that only support signals */
native_exit_code_type native_exit_code() const;
// Checks if the current process is running.
/* If it has already completed the exit code will be stored internally
* and can be obtained by calling `exit_code.
*/
bool running();
bool running(error_code & ec) noexcept;
// Check if the process is referring to an existing process.
/** Note that this might be a process that already exited.*/
bool is_open() const;
// Asynchronously wait for the process to exit and deliver the native exit-code in the completion handler.
template <BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (error_code, int))
WaitHandler = net::default_completion_token_t<executor_type>>
auto async_wait(WaitHandler && handler = net::default_completion_token_t<executor_type>());
};
// Process with the default executor.
typedef basic_process<> process;
----

View File

@@ -0,0 +1,108 @@
== `process_handle.hpp`
[#process_handle]
A process handle is an unmanaged version of a process.
This means it does not terminate the proces on destruction and
will not keep track of the exit-code.
NOTE: that the exit code might be discovered early, during a call to `running`.
Thus it can only be discovered that process has exited already.
[source,cpp]
----
template<typename Executor = net::any_io_executor>
struct basic_process_handle
{
// The native handle of the process.
/* This might be undefined on posix systems that only support signals */
using native_handle_type = implementation_defined;
// The executor_type of the process_handle
using executor_type = Executor;
// Getter for the executor
executor_type get_executor();
// Rebinds the process_handle to another executor.
template<typename Executor1>
struct rebind_executor
{
// The socket type when rebound to the specified executor.
typedef basic_process_handle<Executor1> other;
};
// Construct a basic_process_handle from an execution_context.
/*
* @tparam ExecutionContext The context must fulfill the asio::execution_context requirements
*/
template<typename ExecutionContext>
basic_process_handle(ExecutionContext &context);
// Construct an empty process_handle from an executor.
basic_process_handle(executor_type executor);
// Construct an empty process_handle from an executor and bind it to a pid.
/* On NON-linux posix systems this call is not able to obtain a file-descriptor and will thus
* rely on signals.
*/
basic_process_handle(executor_type executor, pid_type pid);
// Construct an empty process_handle from an executor and bind it to a pid and the native-handle
/* On some non-linux posix systems this overload is not present.
*/
basic_process_handle(executor_type executor, pid_type pid, native_handle_type process_handle);
// Move construct and rebind the executor.
template<typename Executor1>
basic_process_handle(basic_process_handle<Executor1> &&handle);
// Get the id of the process
pid_type id() const
{ return pid_; }
// Terminate the process if it's still running and ignore the result
void terminate_if_running(error_code &);
// Throwing @overload void terminate_if_running(error_code & ec;
void terminate_if_running();
// wait for the process to exit and store the exit code in exit_status.
void wait(native_exit_code_type &exit_status, error_code &ec);
// Throwing @overload wait(native_exit_code_type &exit_code, error_code & ec)
void wait(native_exit_code_type &exit_status);
// Sends the process a signal to ask for an interrupt, which the process may interpret as a shutdown.
/* Maybe be ignored by the subprocess. */
void interrupt(error_code &ec);
// Throwing @overload void interrupt()
void interrupt();
// Sends the process a signal to ask for a graceful shutdown. Maybe be ignored by the subprocess.
void request_exit(error_code &ec);
// Throwing @overload void request_exit(error_code & ec)
void request_exit()
// Unconditionally terminates the process and stores the exit code in exit_status.
void terminate(native_exit_code_type &exit_status, error_code &ec);\
// Throwing @overload void terminate(native_exit_code_type &exit_code, error_code & ec)
void terminate(native_exit_code_type &exit_status);/
// Checks if the current process is running.
/*If it has already completed, it assigns the exit code to `exit_code`.
*/
bool running(native_exit_code_type &exit_code, error_code &ec);
// Throwing @overload bool running(native_exit_code_type &exit_code, error_code & ec)
bool running(native_exit_code_type &exit_code);
// Check if the process handle is referring to an existing process.
bool is_open() const;
// Asynchronously wait for the process to exit and deliver the native exit-code in the completion handler.
template<BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void(error_code, native_exit_code_type))
WaitHandler = net::default_completion_token_t<executor_type>>
auto async_wait(WaitHandler &&handler = net::default_completion_token_t<executor_type>());
};
----

57
doc/reference/shell.adoc Normal file
View File

@@ -0,0 +1,57 @@
== `shell.hpp`
[#shell]
This utility class parses command lines into tokens
and allows users to execute processes based on textual inputs.
In v1, this was possible directly when starting a process,
but has been removed based on the security risks associated with this.
By making the shell parsing explicitly, it encourages
a user to run a sanity check on the executable before launching it.
.Example
[source,cpp]
----
asio::io_context ctx;
auto cmd = shell("my-app --help");
auto exe = cmd.exe();
check_if_malicious(exe);
process proc{ctx, exe, cmd.args()};
----
[source,cpp]
----
/// Utility to parse commands
struct shell
{
shell() = default;
template<typename Char, typename Traits>
shell(basic_string_view<Char, Traits> input);
shell(basic_cstring_ref<char_type> input);
shell(const shell &) = delete;
shell(shell && lhs) noexcept;
shell& operator=(const shell &) = delete;
shell& operator=(shell && lhs) noexcept;
// the length of the parsed shell, including the executable
int argc() const ;
char_type** argv() const;
char_type** begin() const;
char_type** end() const;
bool empty() const;
std::size_t size() const;
// Native representation of the arguments to be used - excluding the executable
args_type args() const;
template<typename Environment = environment::current_view>
filesystem::path exe(Environment && env = environment::current()) const;
};
----

View File

@@ -0,0 +1,16 @@
== `start_dir.hpp`
[#start_dir]
[source,cpp]
----
/// Initializer for the starting directory of a subprocess to be launched.
struct process_start_dir
{
filesystem::path start_dir;
process_start_dir(filesystem::path start_dir);
{
}
};
----

55
doc/reference/stdio.adoc Normal file
View File

@@ -0,0 +1,55 @@
== `stdio.hpp`
[#stdio]
The initializer for the stdio of a subprocess
The subprocess stdio initializer has three members:
- in for stdin
- out for stdout
- err for stderr
If the initializer is present all three will be set for the subprocess.
By default they will inherit the stdio handles from the parent process.
This means that this will forward stdio to the subprocess:
[source,cpp]
----
asio::io_context ctx;
v2::process proc(ctx, "/bin/bash", {}, v2::process_stdio{});
----
No constructors are provided in order to support designated initializers
in later version of C++.
[source,cpp]
----
asio::io_context ctx;
/// C++17
v2::process proc17(ctx, "/bin/bash", {}, v2::process_stdio{.stderr=nullptr});
/// C++11 & C++14
v2::process proc17(ctx, "/bin/bash", {}, v2::process_stdio{ {}, {}, nullptr});
----
Valid initializers for any stdio are:
- `std::nullptr_t` assigning a null-device
- `FILE*` any open file, including `stdin`, `stdout` and `stderr`
- a filesystem::path, which will open a readable or writable depending on the direction of the stream
- `native_handle` any native file handle (`HANDLE` on windows) or file descriptor (`int` on posix)
- any io-object with a .native_handle() function that is compatible with the above. E.g. a asio::ip::tcp::socket
- an asio::basic_writeable_pipe for stdin or asio::basic_readable_pipe for stderr/stdout.
[source,cpp]
----
/// The initializer for the stdio of a subprocess
struct process_stdio
{
__implementation_defined__ in;
__implementation_defined__ out;
__implementation_defined__ err;
};
----

View File

@@ -0,0 +1,27 @@
== `windows/creation_flags.hpp`
Creation flags allows explicitly setting `dwFlags`
[source,cpp]
----
// An initializer to add to the dwFlags in the startup-info
template<DWORD Flags>
struct process_creation_flags;
// A flag to create a new process group. Necessary to allow interrupts for the subprocess.
constexpr static process_creation_flags<CREATE_NEW_PROCESS_GROUP> create_new_process_group;
// Breakaway from the current job object.
constexpr static process_creation_flags<CREATE_BREAKAWAY_FROM_JOB> create_breakaway_from_job;
// Allocate a new console.
constexpr static process_creation_flags<CREATE_NEW_CONSOLE> create_new_console;
----
The flags can be used like this:
[source,cpp]
----
process p{"C:\\not-a-virus.exe", {}, process::windows::create_new_console};
----

View File

@@ -0,0 +1,32 @@
== `windows/show_window.hpp`
Creation flags allows explicitly setting `wShowWindow` options
[source,cpp]
----
/// A templated initializer to set wShowWindow flags.
template<DWORD Flags>
struct process_show_window;
//Hides the window and activates another window.
constexpr static process_show_window<SW_HIDE > show_window_hide;
//Activates the window and displays it as a maximized window.
constexpr static process_show_window<SW_SHOWMAXIMIZED > show_window_maximized;
//Activates the window and displays it as a minimized window.
constexpr static process_show_window<SW_SHOWMINIMIZED > show_window_minimized;
//Displays the window as a minimized window. This value is similar to `minimized`, except the window is not activated.
constexpr static process_show_window<SW_SHOWMINNOACTIVE> show_window_minimized_not_active;
//Displays a window in its most recent size and position. This value is similar to show_normal`, except that the window is not activated.
constexpr static process_show_window<SW_SHOWNOACTIVATE > show_window_not_active;
//Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
constexpr static process_show_window<SW_SHOWNORMAL > show_window_normal;
----
The flags can be used like this:
[source,cpp]
----
process p{"C:\\not-a-virus.exe", {}, process::windows::show_window_minimized};
----

13
doc/start_dir.adoc Normal file
View File

@@ -0,0 +1,13 @@
== `process_start_dir`
The easier initializer to use is `process_start_dir`:
.example/start_dir.cpp:17-20
[source,cpp,indent=0]
----
include::../example/start_dir.cpp[tag=start_dir]
----
This will run `ls` in the folder `/home` instead of the current folder.
WARNING: If your path is relative, it may fail on posix, because the directory is changed before a call to execve.

65
doc/stdio.adoc Normal file
View File

@@ -0,0 +1,65 @@
= stdio
When using io with a subprocess, all three standard streams (stdin, stdout, stderr) get set for the child-process.
The default setting is to inherit the parent process.
This feature meant to be flexible, which is why there is little checking on the arguments assigned to one of those streams.
== Pipes
asio pipes can be used for io. When using in process_stdio they will get
automatically connected and the other side will get assigned to the child process:
.example/stdio.cpp:20-29
[source,cpp,indent=0]
----
include::../example/stdio.cpp[tag=readable_pipe]
----
readable pipes can be assigned to `out` an `err`, while writable_pipes can be assigned to `in`.
== `FILE*`
`FILE*` can also be used for either side; this allows the `stdin`, `stderr`, `stdout` macros to be used:
.example/stdio.cpp:35-38
[source,cpp]
----
include::../example/stdio.cpp[tag=file]
----
== `nullptr`
`nullptr` may be used to set a given stream to be opened on the null-device (`/dev/null` on posix, `NUL` on windows).
This is used to ignore output or give only EOF as input.
.example/stdio.cpp:43-46
[source,cpp]
----
include::../example/stdio.cpp[tag=null]
----
== `native_handle`
A native handle can be used as well, which means an `int` on posix or a `HANDLE` on windows.
Furthermore, any object that has a `native_handle` function which returns a valid type for a stdio stream.
E.g. a domain socket on linux.
.example/stdio.cpp:52-57
[source,cpp]
----
include::../example/stdio.cpp[tag=native_handle]
----
== popen
Additionally, process v2 provides a `popen` class.
It starts a process and connects pipes for stdin and stdout, so that the popen object can be used as a stream.
.example/stdio.cpp:63-66
[source,cpp]
----
include::../example/stdio.cpp[tag=popen]
----

View File

@@ -1,431 +0,0 @@
[def bp::system [funcref boost::process::system bp::system]]
[def bp::spawn [funcref boost::process::system bp::spawn]]
[def bp::child [classref boost::process::child bp::child]]
[def bp::group [classref boost::process::group bp::group]]
[def bp::ipstream [classref boost::process::ipstream bp::ipstream]]
[def bp::opstream [classref boost::process::opstream bp::opstream]]
[def bp::pstream [classref boost::process::pstream bp::pstream]]
[def bp::pipe [classref boost::process::pipe bp::pipe]]
[def boost_org [@www.boost.org "www.boost.org"]]
[def std::system [@http://en.cppreference.com/w/cpp/utility/program/system std::system]]
[def child_running [memberref boost::process::child::running running]]
[def child_wait [memberref boost::process::child::wait wait]]
[def child_exit_code [memberref boost::process::child::exit_code exit_code]]
[def bp::on_exit [globalref boost::process::on_exit bp::on_exit]]
[def bp::null [globalref boost::process::null bp::null]]
[def child_terminate [memberref boost::process::child::terminate terminate]]
[def group_terminate [memberref boost::process::group::terminate terminate]]
[def bp::std_in [globalref boost::process::std_in bp::std_in]]
[def bp::std_out [globalref boost::process::std_out bp::std_out]]
[def bp::std_err [globalref boost::process::std_err bp::std_err]]
[def io_service [@http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/io_service.html boost::asio::io_service]]
[def asio_buffer [@http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/buffer.html boost::asio::buffer]]
[def asio_async_read [@http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/async_read.html boost::asio::async_read]]
[def bp::environment [classref boost::process::basic_environment bp::environment]]
[def bp::native_environment [classref boost::process::basic_native_environment bp::native_environment]]
[def boost::this_process::environment [funcref boost::this_process::environment boost::this_process::environment]]
[def __wait_for__ [memberref boost::process::child::wait_for wait_for]]
[def __wait_until__ [memberref boost::process::child::wait_until wait_until]]
[def __detach__ [memberref boost::process::child::detach detach]]
[def __reference__ [link process.reference reference]]
[def boost::asio::yield_context [@http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/yield_context.html boost::asio::yield_context]]
[def boost::asio::coroutine [@http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/coroutine.html boost::asio::coroutine]]
[section:tutorial Tutorial]
In this section we will go step by step through the different features of
boost.process. For a full description see the __reference__.
[section Starting a process]
We want to start a process, so let's start with a simple process. We will
invoke the gcc compiler to compile a simple program.
With the standard library this looks like this.
```
int result = std::system("g++ main.cpp");
```
Which we can write exactly like this in boost.process.
```
namespace bp = boost::process; //we will assume this for all further examples
int result = bp::system("g++ main.cpp");
```
The first thing we can do, is to separate the command and the executable into
two parts, so it is more readable and can be built by a function.
```
int result = bp::system("g++", "main.cpp");
```
With that sytax we still have "g++" hard-coded, so let's assume we get the string
from an external source as `boost::filesystem::path`, we can do this too.
```
boost::filesystem::path p = "g++"; //or get it from somewhere else.
int result = bp::system(p, "main.cpp");
```
Now, there is a subtle difference between the two syntaxes, i.e. passing a
single string or passing multiple. When passing multiple string, the first string will be
interpreted as the name of a file and the rest as arguments;
when passing one string it will be interpreted as a command.
For more details please see the [link boost_process.design.arg_cmd_style design description].
[endsect]
[section:launch_mode Launch functions]
Given that in our example used the [funcref boost::process::system system] function,
our program will wait until the child process is completed. This is unwanted,
especially since compiling can take a while.
In order to avoid that, boost.process provides several ways to launch a process.
Besides the already mentioned [funcref boost::process::system system] function,
we can also use the [funcref boost::process::spawn spawn] function or the
[classref boost::process::child child] class.
The [funcref boost::process::spawn spawn] function launches a process and
immediately detaches so, so no handle will be returned and the process will be ignored.
This is not what we need for compiling, but maybe we want to entertain the user,
while compiling:
```
bp::spawn("chrome", boost_org);
```
Now for the more sensible approach for compiling, we want a non-blocking execution.
To implement that, we directly call the constructor of [classref boost::process::child child].
```
bp::child c("g++", "main.cpp");
while (c.child_running())
do_some_stuff();
c.child_wait(); //wait for the process to exit
int result = c.child_exit_code();
```
So we launch the process, by calling the child constructor. Then we check and do other
things while the process is running and afterwards get the exit code. The call
to child_wait is necessary, to obtain it and tell the operating system, that no
one is waiting for the process anymore.
[note You can also wait for a time span or a until a time point with __wait_for__ and __wait_until__]
[warning If you don't call wait on a child object, it will be terminated on destruction.
This can be avoided by calling __detach__ beforehand]
[endsect]
[section:error_handling Error]
Until now, we have assumed that everything works out, but it is not impossible,
that "g++" is not present. That will cause the launch of the process to fail.
The default behaviour of all functions is to throw an
[@http://en.cppreference.com/w/cpp/error/system_error std::system_error] on failure.
As with many other functions in this library, passing an [@http://en.cppreference.com/w/cpp/error/error_code std::error_code]
will change the behaviour, so that instead of throwing an exception, the error will be a assigned to the error code.
```
std::error_code ec;
bp::system c("g++", "main.cpp", ec);
```
[endsect]
[section:io Synchronous I/O]
In the examples given above, we have only started a program, but did not consider the output.
The default depends on the system, but usually this will just write it to the same output as the launching process.
If this shall be guaranteed, the streams can be explicitly forwarded like this.
```
bp::system("g++", bp::std_out > stdout, bp::std_err > stderr, bp::std_in < stdin);
```
Now for the first example, we might want to just ignore the output, which can be done by redirecting it to the null-device.
This can be achieved this way:
```
bp::system("g++", "main.cpp", bp::std_out > bp::null);
```
Alternatively we can also easily redirect the output to a file:
```
bp::system("g++", "main.cpp", bp::std_out > "gcc_out.log");
```
Now, let's take a more visual example for reading data.
[@http://pubs.opengroup.org/onlinepubs/009696699/utilities/nm.html nm] is a tool on posix,
which reads the outline, i.e. a list of all entry points, of a binary.
Every entry point will be put into a single line, and we will use a pipe to read it.
At the end an empty line is appended, which we use as the indication to stop reading.
Boost.process provides the pipestream ([classref boost::process::ipstream ipstream],
[classref boost::process::opstream opstream], [classref boost::process::pstream pstream]) to
wrap around the [classref boost::process::pipe pipe] and provide an implementation of the
[@http://en.cppreference.com/w/cpp/io/basic_istream std::istream],
[@http://en.cppreference.com/w/cpp/io/basic_ostream std::ostream] and
[@http://en.cppreference.com/w/cpp/io/basic_iostream std::iostream] interface.
```
std::vector<std::string> read_outline(std::string & file)
{
bp::ipstream is; //reading pipe-stream
bp::child c("nm", file, bp::std_out > is);
std::vector<std::string> data;
std::string line;
while (c.child_running() && std::getline(is, line) && !line.empty())
data.push_back(line);
c.child_wait();
return data;
}
```
What this does is redirect the `stdout` of the process into a pipe and we read this
synchronously.
[warning The pipe will cause a deadlock if you try to read after nm exited]
[note You can do the same thing with [globalref boost::process::std_err std_err]]
Now we get the name from `nm` and we might want to demangle it, so we use input and output.
`nm` has a demangle option, but for the sake of the example, we'll use
[@https://sourceware.org/binutils/docs/binutils/c_002b_002bfilt.html c++filt] for this.
```
bp::opstream in;
bp::ipstream out;
bp::child c("c++filt", std_out > out, std_in < in);
in << "_ZN5boost7process8tutorialE" << endl;
std::string value;
out >> value;
c.child_terminate();
```
Now you might want to forward output from one process to another processes input.
```
std::vector<std::string> read_demangled_outline(const std::string & file)
{
bp::pipe p;
bp::ipstream is;
std::vector<std::string> outline;
//we just use the same pipe, so the
bp::child nm("nm", file, bp::std_out > p);
bp::child filt("c++filt", bp::std_in < p, bp::std_out > is);
while (nm.running()) //nm finishes automatically, so then we can terminate c++filt.
{
std::string line;
std::getline(is, line);
outline.push_back(line);
}
nm.child_wait();
filt.child_terminate();
}
```
Now this forwards the data from `nm` to `c++filt` without your process needing to do anything.
[endsect]
[section:async_io Asynchronous I/O]
Boost.process allows the usage of boost.asio to implement asynchronous I/O.
If you are familiar with [@http://www.boost.org/doc/libs/release/libs/asio/ boost.asio] (which we highly recommend),
you can use [classref boost::process::async_pipe async_pipe] which is implemented
as an I/O-Object and can be used like [classref boost::process::pipe pipe] as shown above.
Now we get back to our compiling example. `nm` we might analyze it line by line,
but the compiler output will just be put into one large buffer.
With [@http://www.boost.org/doc/libs/release/libs/asio/ boost.asio] this is what it looks like.
```
io_service ios;
std::vector<char> buf;
bp::async_pipe ap(ios);
child c("g++", "main.cpp", bp::std_out > ap);
asio_async_read(ap, asio_buffer(buf),
[](const boost::system::error_code &ec, std::size_t size){});
ios.run();
c.wait();
int result = c.exit_code();
```
To make it easier, boost.process provides simpler interface for that, so that the buffer can be passed directly,
provided we also pass a reference to an io_service.
```
io_service ios;
std::vector<char> buf;
child c("g++", "main.cpp", bp::std_out > asio_buffer(buf), ios);
ios.run();
c.wait();
int result = c.exit_code();
```
[note Passing an instance of io_service to the launching function automatically cause it to wait asynchronously for the exit, so no call of
[memberref boost::process::child::wait wait] is needed]
To make it even easier, you can use [@http://en.cppreference.com/w/cpp/thread/future std::future] for asynchronous operations
(you will still need to pass a reference to a io_service) to the launching function, unless you use bp::system.
Now we will revisit our first example and read the compiler output asynchronously:
```
boost::asio::io_service ios;
std::future<std::string> data;
child c("g++", "main.cpp", //set the input
bp::std_in.close(),
bp::std_out > bp::null, //so it can be written without anything
bp::std_err > data,
ios);
ios.run(); //this will actually block until the compiler is finished
auto err = fut.get();
```
[endsect]
[section:group Groups]
When launching several processes, processes can be grouped together.
This will also apply for a child process, that launches other processes,
if they do not modifiy the group membership. E.g. if you call `make` which
launches other processes and call terminate on it,
it will not terminate all the child processes of the child unless you use a group.
```
bp::group g;
bp::child c1("foo", g);
bp::child c2("bar", g);
g.group_terminate();
```
Please see to the [headerref boost/process/group.hpp reference] for more information.
[endsect]
[section:env Environment]
This library provides access to the environment of the current process and allows
setting it for the child process.
```
//get a handle to the current environment
auto env = boost::this_process::environment();
//add a variable to the current environment
env["VALUE_1"] = "foo";
//copy it into a environment seperate to the one of this process
bp::environment env_ = env;
//add a value only to the new env
env_["VALUE_2"] = "bar";
//launch a process with `env_`
bp::system("stuff", env_);
```
A more convenient way to modify the environment for the child is the
[globalref boost::process::env env] property.
Please see to the [headerref boost/process/environment.hpp reference] for more information.
[endsect]
[section:coro Coroutines]
[section:stackless Stackless Coroutines]
[note This section presumes knowledge of the boost.asio
[@http://www.boost.org/doc/libs/release/doc/html/boost_asio/overview/core/coroutine.html stackless coroutine] feature.]
Stackless coroutines can be implemented rather easily, so there is no need to
implement extra functionality concerning boost.process.
```
struct stackless_t : boost::asio::coroutine
{
bp::child c;
boost::asio::io_service & ios;
stackless_t(boost::asio::io_service & ios) : ios(ios) {}
void operator()(
boost::system::error_code ec = boost::system::error_code(),
std::size_t n = 0)
{
if (!ec) reenter (this)
{
c = bp::child("my_program", ios,
bp::on_exit=
[this](int, const std::error_code&)
{
(*this)(); //this is the reentry for the coroutine
});
yield; //yield the thing.
}
}
};
///post the coroutine to a io-service and run it
int main()
{
boost::asio::io_service ios;
ios.post(stackless_t(ios));
ios.run();
return 0;
}
```
[endsect]
[section:stackful Stackful Coroutines]
[note This section presumes knowledge of the boost.asio
[@http://www.boost.org/doc/libs/release/doc/html/boost_asio/overview/core/spawn.html stackful coroutine] feature.]
For stackful coroutines this is not as simple, because the members of
`boost::asio::yield_context` are not documented. Therefore, boost.process
provides a simple way to use stackful coroutines, which looks as follows:
```
void cr(boost::asio::yield_context yield_)
{
bp::system("my-program", yield_);
}
```
This will automatically suspend the coroutine until the child process is finished.
[endsect]
[endsect]
[endsect]

81
doc/version2.adoc Normal file
View File

@@ -0,0 +1,81 @@
= Version 2
Boost.process V2 is an redesign of boost.process, based on previous
design mistakes & improved system APIs.
The major changes are
* Simplified interface
* Reliance on pidfd_open on linux
* Full asio integration
* Removed unreliable functionality
* UTF8 Support
* separate compilation
* fd safe by default
Version 2 is now the defauled. In order to discourage usage of the deprecated v1, it's documentation has been removed.
== Simplified Interface
In process v1 one can define partial settings in the constructor of the process,
which has lead to a small DSL.
[source,cpp]
----
child c{exe="test", args+="--help", std_in < null(), env["FOO"] += "BAR"};
----
While this looks fancy at first, it really does not scale well with more parameters.
For process v2, the interfaces is simple:
[source,cpp]
----
extern std::unordered_map<std::string, std::string> my_env;
extern asio::io_context ctx;
process proc(ctx, "./test", {"--help"}, process_stdio{nullptr, {}, {}}, process_environment(my_env));
----
Every initializer addresses one logical component (e.g. stdio) instead of multiple ones accumulating.
Furthermore, every process has a path and arguments, instead of a confusing mixture of cmd-style and
exe-args that can be randomly spread out.
== `pidfd_open`
Since process v1 came out, linux has moved along and added [pidfd_open](https://man7.org/linux/man-pages/man2/pidfd_open.2.html)
which allows users to obtain a descriptor for a process.
This is much more reliable since it is not as easy to miss as a `SIGCHLD`.
Windows has provided `HANDLE`s for processes all along.
Unless the OS doesn't support it, process v2 will use file descriptors and handles to implement waiting
for processes.
== Full asio integration
Process v1 aimed to make asio optional, but synchronous IO with subprocesses usually means one is begging
for deadlocks.
Since asio added pipes in boost 1.78, boost process V2 is fully asio based and uses it's pipes and
file-handles for the subprocess.
== Unreliable functionality
Certain parts of boost.process were not as reliable as they should've been.
This concerns especially the `wait_for` and `wait_until` functions on the process.
The latter are easy to do on windows, but posix does not provide an API for this.
Thus the wait_for used signals or fork, which was all but safe.
Since process v2 is based on asio and thus supports cancellation,
a wait_for can not safely be implemented with an async_wait + timeout.
== UTF-8
Instead of using ascii-APIs on windows, process V2 just assumes UTF-8 everywhere
and uses the UTF-16 APIs.
== Fd safe by default
While not a problem on windows (since HANDLEs get manually enabled for inheritance),
posix systems create a problem with inheriting file handles by default.
Process V2 will automatically close all non-whitelisted descriptors,
without needing any option to enable it.

View File

@@ -1,28 +1,19 @@
# 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
# Copyright (c) 2022 Klemens Morgenstern
#
# 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
<link>static
;
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 ;
exe intro : intro.cpp /boost//process : <boost.process.fs>boost ;
exe intro_popen : intro_popen.cpp /boost//process : <boost.process.fs>boost ;
exe quickstart : quickstart.cpp /boost//process : <boost.process.fs>boost ;
exe env : env.cpp /boost//process : <boost.process.fs>boost ;
exe start_dir : start_dir.cpp /boost//process : <boost.process.fs>boost ;
exe stdio : stdio.cpp /boost//process : <boost.process.fs>boost ;

View File

@@ -1,29 +0,0 @@
// 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

@@ -8,17 +8,38 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <unordered_map>
namespace bp = boost::process;
using namespace boost::process;
namespace asio = boost::asio;
int main()
{
bp::environment my_env = boost::this_process::environment();
{ // tag::current_env[]
// search in the current environment
auto exe = environment::find_executable("g++");
my_env["PATH"] += "/foo";
bp::system("test.exe", my_env);
std::unordered_map <environment::key, environment::value> my_env =
{
{"SECRET", "THIS_IS_A_TEST"},
{"PATH", {"/bin", "/usr/bin"}}
};
auto other_exe = environment::find_executable("g++", my_env);
//end::current_env[]
}
bp::system("test.exe", bp::env["PATH"]+="/bar");
{
// tag::subprocess_env[]
asio::io_context ctx;
std::unordered_map<environment::key, environment::value> my_env =
{
{"SECRET", "THIS_IS_A_TEST"},
{"PATH", {"/bin", "/usr/bin"}}
};
auto exe = environment::find_executable("g++", my_env);
process proc(ctx, exe, {"main.cpp"}, process_environment(my_env));
process pro2(ctx, exe, {"test.cpp"}, process_environment(my_env));
// end::subprocess_env[]
}
}

View File

@@ -1,24 +0,0 @@
// 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

@@ -1,8 +1,4 @@
// 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
// Copyright (c) 2022 Klemens Morgenstern
//
// 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)
@@ -10,18 +6,35 @@
//[intro
#include <boost/process.hpp>
using namespace boost::process;
#include <boost/asio/read.hpp>
#include <boost/asio/readable_pipe.hpp>
#include <boost/system/error_code.hpp>
#include <string>
#include <iostream>
namespace proc = boost::process;
namespace asio = boost::asio;
int main()
{
ipstream pipe_stream;
child c("gcc.exe", "--version", std_out > pipe_stream);
asio::io_context ctx;
asio::readable_pipe p{ctx};
const auto exe = proc::environment::find_executable("gcc");
proc::process c{ctx, exe, {"--version"}, proc::process_stdio{nullptr, p}};
std::string line;
boost::system::error_code ec;
while (pipe_stream && std::getline(pipe_stream, line) && !line.empty())
std::cerr << line << std::endl;
auto sz = asio::read(p, asio::dynamic_buffer(line), ec);
assert(ec == asio::error::eof);
std::cout << "Gcc version: '" << line << "'" << std::endl;
c.wait();
return c.exit_code();
}
//]

41
example/intro_popen.cpp Normal file
View File

@@ -0,0 +1,41 @@
// Copyright (c) 2022Klemens Morgenstern
//
// 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/core/ignore_unused.hpp>
//[intro
#include <boost/process.hpp>
#include <boost/asio/read.hpp>
#include <boost/asio/readable_pipe.hpp>
#include <boost/system/error_code.hpp>
#include <string>
#include <iostream>
namespace proc = boost::process;
namespace asio = boost::asio;
int main()
{
asio::io_context ctx;
const auto exe = proc::environment::find_executable("gcc");
proc::popen c{ctx, exe, {"--version"}};
std::string line;
boost::system::error_code ec;
auto sz = asio::read(c, asio::dynamic_buffer(line), ec);
assert(ec == asio::error::eof);
boost::ignore_unused(sz);
std::cout << "Gcc version: '" << line << "'" << std::endl;
c.wait();
return c.exit_code();
}
//]

View File

@@ -1,91 +0,0 @@
// 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_service io_service;
bp::async_pipe p1(io_service);
bp::async_pipe p2(io_service);
bp::system(
"test.exe",
bp::std_out > p2,
bp::std_in < p1,
io_service,
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_service io_service;
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_service io_service;
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

@@ -1,46 +0,0 @@
// 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 <iostream>
#include <fstream>
#include <unistd.h>
#include <errno.h>
using namespace boost::process;
int main()
{
//duplicate our pipe descriptor into literal position 4
pipe p;
system("test", posix::fd.bind(4, p.native_sink()) );
//close file-descriptor from explicit integral value
system("test", posix::fd.close(STDIN_FILENO));
//close file-descriptors from explicit integral values
system("test", posix::fd.close({STDIN_FILENO, STDOUT_FILENO}));
//add custom handlers
const char *env[2] = { 0 };
env[0] = "LANG=de";
system("test",
on_setup([env](auto &e) { e.env = const_cast<char**>(env); }),
posix::on_fork_error([](auto&)
{ std::cerr << errno << std::endl; }),
posix::on_exec_setup([](auto&)
{ ::chroot("/new/root/directory/"); }),
posix::on_exec_error([](auto&)
{ std::ofstream ofs("log.txt"); if (ofs) ofs << errno; })
);
}

63
example/quickstart.cpp Normal file
View File

@@ -0,0 +1,63 @@
#include <boost/process.hpp>
#include <boost/asio.hpp>
namespace asio = boost::asio;
using boost::process::process;
int main(int /*argv*/, char ** /*argv*/)
{
asio::io_context ctx;
{
//tag::cp[]
// process(asio::any_io_executor, filesystem::path, range<string> args, AdditionalInitializers...)
process proc(ctx.get_executor(), // <1>
"/usr/bin/cp", // <2>
{"source.txt", "target.txt"} // <3>
); // <4>
//end::cp[]
}
{
//tag::ls[]
process proc(ctx, "/bin/ls", {});
assert(proc.wait() == 0);
//end::ls[]
}
{
//tag::terminate[]
process proc(ctx, "/bin/totally-not-a-virus", {});
proc.terminate();
//end::terminate[]
}
{
//tag::request_exit[]
process proc(ctx, "/bin/bash", {});
proc.request_exit();
proc.wait();
//end::request_exit[]
}
{
//tag::interrupt[]
process proc(ctx, "/usr/bin/addr2line", {});
proc.interrupt();
proc.wait();
//end::interrupt[]
}
{
//tag::execute[]
assert(execute(process(ctx, "/bin/ls", {})) == 0);
//end::execute[]
}
{
//tag::async_execute[]
async_execute(process(ctx, "/usr/bin/g++", {"hello_world.cpp"}))
(asio::cancel_after(std::chrono::seconds(10), asio::cancellation_type::partial)) // <1>
(asio::cancel_after(std::chrono::seconds(10), asio::cancellation_type::terminal)) //<2>
(asio::detached);
//end::async_execute[]
ctx.run();
}
return 0;
}

View File

@@ -8,20 +8,15 @@
// 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;
using namespace boost::process;
namespace asio = boost::asio;
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"
);
// tag::start_dir[]
asio::io_context ctx;
process ls(ctx.get_executor(), "/ls", {}, process_start_dir("/home"));
ls.wait();
// end::start_dir[]
}

70
example/stdio.cpp Normal file
View File

@@ -0,0 +1,70 @@
// 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>
using namespace boost::process;
namespace asio = boost::asio;
int main(int argc, char *argv[])
{
{
//tag::readable_pipe[]
asio::io_context ctx;
asio::readable_pipe rp{ctx};
process proc(ctx, "/usr/bin/g++", {"--version"}, process_stdio{{ /* in to default */}, rp, { /* err to default */ }});
std::string output;
boost::system::error_code ec;
asio::read(rp, asio::dynamic_buffer(output), ec);
assert(!ec || (ec == asio::error::eof));
proc.wait();
//end::readable_pipe[]
}
{
//tag::file[]
asio::io_context ctx;
// forward both stderr & stdout to stdout of the parent process
process proc(ctx, "/usr/bin/g++", {"--version"}, process_stdio{{ /* in to default */}, stdout, stdout});
proc.wait();
//end::file[]
}
{
//tag::null[]
asio::io_context ctx;
// forward stderr to /dev/null or NUL
process proc(ctx, "/usr/bin/g++", {"--version"}, process_stdio{{ /* in to default */}, {}, nullptr});
proc.wait();
//end::null[]
}
#if defined(BOOST_POSIX_API)
{
//tag::native_handle[]
asio::io_context ctx;
// ignore stderr
asio::local::stream_protocol::socket sock{ctx}, other{ctx};
asio::local::connect_pair(sock, other);
process proc(ctx, "~/not-a-virus", {}, process_stdio{sock, sock, nullptr});
proc.wait();
//end::native_handle[]
}
#endif
{
//tag::popen[]
asio::io_context ctx;
boost::process::popen proc(ctx, "/usr/bin/addr2line", {argv[0]});
asio::write(proc, asio::buffer("main\n"));
std::string line;
asio::read_until(proc, asio::dynamic_buffer(line), '\n');
//end::popen[]
}
}

View File

@@ -1,28 +0,0 @@
// 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

@@ -1,18 +0,0 @@
// 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

@@ -1,34 +0,0 @@
// 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_service io_service;
bp::child c(
"test.exe",
io_service,
bp::on_exit([&](int exit, const std::error_code& ec_in){})
);
io_service.run();
}
}

View File

@@ -1,30 +0,0 @@
// 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; })
);
}

14
filter_section_warning.py Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/python
#
import sys
for line in sys.stdin:
# If line is a 'noisy' warning, don't print it or the following two lines.
if ('warning: section' in line and 'is deprecated' in line
or 'note: change section name to' in line):
next(sys.stdin)
next(sys.stdin)
else:
sys.stdout.write(line)
sys.stdout.flush()

View File

@@ -12,29 +12,18 @@
#ifndef BOOST_PROCESS_HPP
#define BOOST_PROCESS_HPP
/**
* \file boost/process.hpp
*
* Convenience header which includes all public and platform-independent
* boost.process header files.
*/
#include <boost/process/args.hpp>
#include <boost/process/async.hpp>
#include <boost/process/group.hpp>
#include <boost/process/child.hpp>
#include <boost/process/cmd.hpp>
#include <boost/process/env.hpp>
#include <boost/process/bind_launcher.hpp>
#include <boost/process/default_launcher.hpp>
#include <boost/process/environment.hpp>
#include <boost/process/error.hpp>
#include <boost/process/exe.hpp>
#include <boost/process/group.hpp>
#include <boost/process/io.hpp>
#include <boost/process/pipe.hpp>
#include <boost/process/execute.hpp>
#include <boost/process/exit_code.hpp>
#include <boost/process/ext.hpp>
#include <boost/process/pid.hpp>
#include <boost/process/popen.hpp>
#include <boost/process/process.hpp>
#include <boost/process/shell.hpp>
#include <boost/process/search_path.hpp>
#include <boost/process/spawn.hpp>
#include <boost/process/system.hpp>
#include <boost/process/start_dir.hpp>
#include <boost/process/stdio.hpp>
#endif

View File

@@ -1,121 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
/** \file boost/process/async.hpp
The header which provides the basic asynchrounous features.
It provides the on_exit property, which allows callbacks when the process exits.
It also implements the necessary traits for passing an boost::asio::io_service,
which is needed for asynchronous communication.
It also pulls the [boost::asio::buffer](http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/buffer.html)
into the boost::process namespace for convenience.
\xmlonly
<programlisting>
namespace boost {
namespace process {
<emphasis>unspecified</emphasis> <ulink url="http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/buffer.html">buffer</ulink>;
<emphasis>unspecified</emphasis> <globalname alt="boost::process::on_exit">on_exit</globalname>;
}
}
</programlisting>
\endxmlonly
*/
#ifndef BOOST_PROCESS_ASYNC_HPP_
#define BOOST_PROCESS_ASYNC_HPP_
#include <boost/process/detail/traits.hpp>
#include <boost/process/detail/on_exit.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/streambuf.hpp>
#include <boost/asio/buffer.hpp>
#include <type_traits>
#include <boost/fusion/iterator/deref.hpp>
#if defined(BOOST_POSIX_API)
#include <boost/process/detail/posix/io_service_ref.hpp>
#include <boost/process/detail/posix/async_in.hpp>
#include <boost/process/detail/posix/async_out.hpp>
#include <boost/process/detail/posix/on_exit.hpp>
#elif defined(BOOST_WINDOWS_API)
#include <boost/process/detail/windows/io_service_ref.hpp>
#include <boost/process/detail/windows/async_in.hpp>
#include <boost/process/detail/windows/async_out.hpp>
#include <boost/process/detail/windows/on_exit.hpp>
#endif
namespace boost { namespace process { namespace detail {
struct async_tag;
template<typename T>
struct is_io_service : std::false_type {};
template<>
struct is_io_service<api::io_service_ref> : std::true_type {};
template<typename Tuple>
inline asio::io_service& get_io_service(const Tuple & tup)
{
auto& ref = *boost::fusion::find_if<is_io_service<boost::mpl::_>>(tup);
return ref.get();
}
struct async_builder
{
boost::asio::io_service * ios;
void operator()(boost::asio::io_service & ios_) {this->ios = &ios_;};
typedef api::io_service_ref result_type;
api::io_service_ref get_initializer() {return api::io_service_ref (*ios);};
};
template<>
struct initializer_builder<async_tag>
{
typedef async_builder type;
};
}
using ::boost::asio::buffer;
#if defined(BOOST_PROCESS_DOXYGEN)
/** When an io_service is passed, the on_exit property can be used, to be notified
when the child process exits.
The following syntax is valid
\code{.cpp}
on_exit=function;
on_exit(function);
\endcode
with `function` being a callable object with the signature `(int, const std::error_code&)`.
\par Example
\code{.cpp}
io_service ios;
spawn("ls", on_exit=[](int exit, const std::error_code& ec_in){});
\endcode
*/
constexpr static ::boost::process::detail::on_exit_ on_exit{};
#endif
}}
#endif /* INCLUDE_BOOST_PROCESS_DETAIL_ASYNC_HPP_ */

View File

@@ -0,0 +1 @@
#include <boost/process/v2/bind_launcher.hpp>

View File

@@ -0,0 +1 @@
#include <boost/process/v2/cstring_ref.hpp>

View File

@@ -0,0 +1 @@
#include <boost/process/v2/default_launcher.hpp>

View File

@@ -1,152 +0,0 @@
/*
* async_handler.hpp
*
* Created on: 12.06.2016
* Author: Klemens
*/
#ifndef BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
#define BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
#include <type_traits>
#if defined(BOOST_POSIX_API)
#include <boost/process/posix.hpp>
#include <boost/process/detail/posix/async_handler.hpp>
#include <boost/process/detail/posix/asio_fwd.hpp>
#else
#include <boost/process/detail/windows/async_handler.hpp>
#include <boost/process/detail/windows/asio_fwd.hpp>
#endif
namespace boost {
namespace process {
namespace detail {
#if defined(BOOST_POSIX_API)
using ::boost::process::detail::posix::is_async_handler;
using ::boost::process::detail::posix::does_require_io_service;
#else
using ::boost::process::detail::windows::is_async_handler;
using ::boost::process::detail::windows::does_require_io_service;
#endif
template<typename ...Args>
struct has_io_service;
template<typename T, typename ...Args>
struct has_io_service<T, Args...>
{
typedef typename has_io_service<Args...>::type next;
typedef typename std::is_same<
typename std::remove_reference<T>::type,
boost::asio::io_service>::type is_ios;
typedef typename std::conditional<is_ios::value,
std::true_type,
next>::type type;
};
template<typename T>
struct has_io_service<T>
{
typedef typename std::is_same<
typename std::remove_reference<T>::type,
boost::asio::io_service>::type type;
};
template<typename ...Args>
using has_io_service_t = typename has_io_service<Args...>::type;
template<typename ...Args>
struct has_async_handler;
template<typename T, typename ...Args>
struct has_async_handler<T, Args...>
{
typedef typename has_async_handler<Args...>::type next;
typedef typename is_async_handler<T>::type is_ios;
typedef typename std::conditional<is_ios::value,
std::true_type,
next>::type type;
};
template<typename T>
struct has_async_handler<T>
{
typedef typename is_async_handler<T>::type type;
};
template<typename ...Args>
struct needs_io_service;
template<typename T, typename ...Args>
struct needs_io_service<T, Args...>
{
typedef typename needs_io_service<Args...>::type next;
typedef typename does_require_io_service<T>::type is_ios;
typedef typename std::conditional<is_ios::value,
std::true_type,
next>::type type;
};
template<typename T>
struct needs_io_service<T>
{
typedef typename does_require_io_service<T>::type type;
};
template<typename T>
struct is_yield_context
{
typedef std::false_type type;
};
template<typename T>
struct is_yield_context<::boost::asio::basic_yield_context<T>>
{
typedef std::true_type type;
};
template<typename ...Args>
struct has_yield_context;
template<typename T, typename ...Args>
struct has_yield_context<T, Args...>
{
typedef typename has_yield_context<Args...>::type next;
typedef typename is_yield_context<
typename std::remove_reference<T>::type>::type is_ios;
typedef typename std::conditional<is_ios::value,
std::true_type,
next>::type type;
};
template<typename T>
struct has_yield_context<T>
{
typedef typename is_yield_context<
typename std::remove_reference<T>::type>::type type;
};
template<typename ...Args>
boost::asio::io_service &get_io_service_var(boost::asio::io_service & f, Args&...args)
{
return f;
}
template<typename First, typename ...Args>
boost::asio::io_service &get_io_service_var(First & f, Args&...args)
{
return get_io_service_var(args...);
}
}
}
}
#endif /* BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_ */

View File

@@ -1,95 +0,0 @@
// 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
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
/**
* \file boost/process/config.hpp
*
* Defines various macros.
*/
#ifndef BOOST_PROCESS_DETAIL_CONFIG_HPP
#define BOOST_PROCESS_DETAIL_CONFIG_HPP
#include <boost/config.hpp>
#include <system_error>
#include <boost/system/api_config.hpp>
#include <boost/process/exception.hpp>
#if defined(BOOST_POSIX_API)
#include <errno.h>
#include <features.h>
#elif defined(BOOST_WINDOWS_API)
#include <boost/detail/winapi/get_last_error.hpp>
#else
#error "System API not supported by boost.process"
#endif
namespace boost { namespace process { namespace detail
{
#if !defined(BOOST_PROCESS_PIPE_SIZE)
#define BOOST_PROCESS_PIPE_SIZE 1024
#endif
#if defined(BOOST_POSIX_API)
namespace posix {namespace extensions {}}
namespace api = posix;
inline std::error_code get_last_error() noexcept
{
return std::error_code(errno, std::system_category());
}
//copied from linux spec.
#if defined (__USE_XOPEN_EXTENDED) && !defined (__USE_XOPEN2K8) || defined( __USE_BSD)
#define BOOST_POSIX_HAS_VFORK 1
#endif
#elif defined(BOOST_WINDOWS_API)
namespace windows {namespace extensions {}}
namespace api = windows;
inline std::error_code get_last_error() noexcept
{
return std::error_code(::boost::detail::winapi::GetLastError(), std::system_category());
}
#endif
inline void throw_last_error(const std::string & msg)
{
throw process_error(get_last_error(), msg);
}
inline void throw_last_error()
{
throw process_error(get_last_error());
}
template<typename Char> constexpr static Char null_char();
template<> constexpr char null_char<char> (){return '\0';}
template<> constexpr wchar_t null_char<wchar_t> (){return L'\0';}
template<typename Char> constexpr static Char equal_sign();
template<> constexpr char equal_sign<char> () {return '='; }
template<> constexpr wchar_t equal_sign<wchar_t> () {return L'='; }
template<typename Char> constexpr static Char quote_sign();
template<> constexpr char quote_sign<char> () {return '"'; }
template<> constexpr wchar_t quote_sign<wchar_t> () {return L'"'; }
template<typename Char> constexpr static Char space_sign();
template<> constexpr char space_sign<char> () {return ' '; }
template<> constexpr wchar_t space_sign<wchar_t> () {return L' '; }
}}}
#endif

View File

@@ -1,94 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_DETAIL_POSIX_ASYNC_IN_HPP
#define BOOST_PROCESS_DETAIL_POSIX_ASYNC_IN_HPP
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/posix/async_handler.hpp>
#include <boost/asio/write.hpp>
#include <boost/process/async_pipe.hpp>
#include <memory>
#include <future>
namespace boost { namespace process { namespace detail { namespace posix {
template<typename Buffer>
struct async_in_buffer : ::boost::process::detail::posix::handler_base_ext,
::boost::process::detail::posix::require_io_service
{
Buffer & buf;
std::shared_ptr<std::promise<void>> promise;
async_in_buffer operator>(std::future<void> & fut)
{
promise = std::make_shared<std::promise<void>>();
fut = promise->get_future(); return std::move(*this);
}
std::shared_ptr<boost::process::async_pipe> pipe;
async_in_buffer(Buffer & buf) : buf(buf)
{
}
template <typename Executor>
inline void on_success(Executor &exec)
{
auto pipe = this->pipe;
if (this->promise)
{
auto promise = this->promise;
boost::asio::async_write(*pipe, buf,
[pipe, promise](const boost::system::error_code & ec, std::size_t)
{
if (ec && (ec.value() != EBADF) && (ec.value() != EPERM) && (ec.value() != ENOENT))
{
std::error_code e(ec.value(), std::system_category());
promise->set_exception(std::make_exception_ptr(process_error(e)));
}
else
promise->set_value();
});
}
else
boost::asio::async_write(*pipe, buf,
[pipe](const boost::system::error_code&ec, std::size_t size){});
::close(pipe->native_source());
this->pipe = nullptr;
}
template<typename Executor>
void on_error(Executor &, const std::error_code &) const
{
::close(pipe->native_source());
}
template<typename Executor>
void on_setup(Executor & exec)
{
pipe = std::make_shared<boost::process::async_pipe>(get_io_service(exec.seq));
}
template <typename Executor>
void on_exec_setup(Executor &exec)
{
if (::dup2(pipe->native_source(), STDIN_FILENO) == -1)
exec.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
::close(pipe->native_source());
}
};
}}}}
#endif

View File

@@ -1,162 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_POSIX_IO_SERVICE_REF_HPP_
#define BOOST_PROCESS_POSIX_IO_SERVICE_REF_HPP_
#include <boost/process/detail/posix/handler.hpp>
#include <boost/process/detail/posix/async_handler.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/algorithm/transformation/filter_if.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/view/transform_view.hpp>
#include <boost/fusion/container/vector/convert.hpp>
#include <functional>
#include <type_traits>
#include <memory>
#include <vector>
#include <sys/wait.h>
namespace boost { namespace process { namespace detail { namespace posix {
template<typename Executor>
struct on_exit_handler_transformer
{
Executor & exec;
on_exit_handler_transformer(Executor & exec) : exec(exec) {}
template<typename Sig>
struct result;
template<typename T>
struct result<on_exit_handler_transformer<Executor>(T&)>
{
typedef typename T::on_exit_handler_t type;
};
template<typename T>
auto operator()(T& t) const -> typename T::on_exit_handler_t
{
return t.on_exit_handler(exec);
}
};
template<typename Executor>
struct async_handler_collector
{
Executor & exec;
std::vector<std::function<void(int, const std::error_code & ec)>> &handlers;
async_handler_collector(Executor & exec,
std::vector<std::function<void(int, const std::error_code & ec)>> &handlers)
: exec(exec), handlers(handlers) {}
template<typename T>
void operator()(T & t) const
{
handlers.push_back(t.on_exit_handler(exec));
};
};
//Also set's up waiting for the exit, so it can close async stuff.
struct io_service_ref : handler_base_ext
{
io_service_ref(boost::asio::io_service & ios) : ios(ios)
{
}
boost::asio::io_service &get() {return ios;};
template <class Executor>
void on_setup(Executor& exec) const
{
//must be on the heap so I can move it into the lambda.
auto asyncs = boost::fusion::filter_if<
is_async_handler<
typename std::remove_reference< boost::mpl::_ > ::type
>>(exec.seq);
//ok, check if there are actually any.
if (boost::fusion::empty(asyncs))
{
return;
}
std::vector<std::function<void(int, const std::error_code & ec)>> funcs;
funcs.reserve(boost::fusion::size(asyncs));
boost::fusion::for_each(asyncs, async_handler_collector<Executor>(exec, funcs));
wait_handler wh(std::move(funcs), ios, exec.exit_status);
auto signal_p = wh.signal_.get();
signal_p->async_wait(std::move(wh));
}
struct wait_handler
{
std::shared_ptr<boost::asio::signal_set> signal_;
std::vector<std::function<void(int, const std::error_code & ec)>> funcs;
std::shared_ptr<std::atomic<int>> exit_status;
wait_handler(const wait_handler & ) = default;
wait_handler(wait_handler && ) = default;
wait_handler(
std::vector<std::function<void(int, const std::error_code & ec)>> && funcs,
boost::asio::io_service & ios,
const std::shared_ptr<std::atomic<int>> &exit_status)
: signal_(new boost::asio::signal_set(ios, SIGCHLD)),
funcs(std::move(funcs)),
exit_status(exit_status)
{
}
void operator()(const boost::system::error_code & ec_in, int /*signal*/)
{
int status;
::wait(&status);
std::error_code ec(ec_in.value(), std::system_category());
int val = WEXITSTATUS(status);
exit_status->store(val);
for (auto & func : funcs)
func(val, ec);
}
};
// Posix specific notifies
template <class PosixExecutor>
void on_fork_setup(PosixExecutor&) const
{
ios.notify_fork(boost::asio::io_service::fork_prepare);
}
template <class PosixExecutor>
void on_fork_success(PosixExecutor&) const
{
ios.notify_fork(boost::asio::io_service::fork_parent);
}
template <class PosixExecutor>
void on_exec_setup(PosixExecutor&) const
{
ios.notify_fork(boost::asio::io_service::fork_child);
}
private:
boost::asio::io_service &ios;
};
}}}}
#endif /* BOOST_PROCESS_WINDOWS_IO_SERVICE_REF_HPP_ */

View File

@@ -1,78 +0,0 @@
// Copyright (c) 2106 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_POSIX_IS_RUNNING_HPP
#define BOOST_PROCESS_DETAIL_POSIX_IS_RUNNING_HPP
#include <boost/process/detail/config.hpp>
#include <boost/process/detail/posix/child_handle.hpp>
#include <system_error>
#include <sys/wait.h>
namespace boost { namespace process { namespace detail { namespace posix {
constexpr static int still_active = 0x7F;
static_assert(!WIFEXITED(still_active), "Internal Error");
inline bool is_running(const child_handle &p, int & exit_code)
{
int status;
auto ret = ::waitpid(p.pid, &status, WNOHANG|WUNTRACED);
if (ret == -1)
{
if (errno != ECHILD) //because it no child is running, than this one isn't either, obviously.
::boost::process::detail::throw_last_error("is_running error");
return false;
}
else if (ret == 0)
return true;
else //exited
{
if (WIFEXITED(status))
exit_code = status;
return false;
}
}
inline bool is_running(const child_handle &p, int & exit_code, std::error_code &ec) noexcept
{
int status;
auto ret = ::waitpid(p.pid, &status, WNOHANG|WUNTRACED);
if (ret == -1)
{
if (errno != ECHILD) //because it no child is running, than this one isn't either, obviously.
ec = ::boost::process::detail::get_last_error();
return false;
}
else if (ret == 0)
return true;
else
{
ec.clear();
if (WIFEXITED(status))
exit_code = status;
return false;
}
}
inline bool is_running(int code)
{
return !WIFEXITED(code);
}
inline int eval_exit_status(int code)
{
return WEXITSTATUS(code);
}
}}}}
#endif

View File

@@ -1,35 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_POSIX_ON_EXIT_HPP_
#define BOOST_PROCESS_POSIX_ON_EXIT_HPP_
#include <boost/process/detail/config.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/posix/async_handler.hpp>
#include <system_error>
#include <functional>
namespace boost { namespace process { namespace detail { namespace posix {
struct on_exit_ : boost::process::detail::posix::async_handler
{
std::function<void(int, const std::error_code&)> handler;
on_exit_(const std::function<void(int, const std::error_code&)> & handler) : handler(handler)
{
}
template<typename Executor>
std::function<void(int, const std::error_code&)> on_exit_handler(Executor & exec)
{
return handler;
};
};
}}}}
#endif /* BOOST_PROCESS_POSIX_ON_EXIT_HPP_ */

View File

@@ -1,51 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_POSIX_PIPE_IN_HPP
#define BOOST_PROCESS_POSIX_PIPE_IN_HPP
#include <boost/process/pipe.hpp>
#include <boost/process/detail/posix/handler.hpp>
#include <unistd.h>
namespace boost { namespace process { namespace detail { namespace posix {
struct pipe_in : handler_base_ext
{
int descr_;
template<typename T>
pipe_in(const T & p) : descr_(p.native_source()) {}
template<typename Executor>
void on_error(Executor &, const std::error_code &) const
{
::close(descr_);
}
template<typename Executor>
void on_success(Executor &) const
{
::close(descr_);
}
template <class Executor>
void on_exec_setup(Executor &e) const
{
if (::dup2(descr_, STDIN_FILENO) == -1)
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
::close(descr_);
}
};
}}}}
#endif

View File

@@ -1,76 +0,0 @@
// 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
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_POSIX_PIPE_OUT_HPP
#define BOOST_PROCESS_DETAIL_POSIX_PIPE_OUT_HPP
#include <boost/process/pipe.hpp>
#include <boost/process/detail/posix/handler.hpp>
#include <unistd.h>
namespace boost { namespace process { namespace detail { namespace posix {
template<int p1, int p2>
struct pipe_out : handler_base_ext
{
int descr_;
template<typename T>
pipe_out(const T & p) : descr_(p.native_sink()) {}
template<typename Executor>
void on_error(Executor &, const std::error_code &) const
{
::close(descr_);
}
template<typename Executor>
void on_success(Executor &) const
{
::close(descr_);
}
template <typename Executor>
void on_exec_setup(Executor &e) const;
};
template<>
template<typename Executor>
void pipe_out<1,-1>::on_exec_setup(Executor &e) const
{
if (::dup2(descr_, STDOUT_FILENO) == -1)
e.set_error(::boost::process::detail::get_last_error(), "dup3() failed");
::close(descr_);
}
template<>
template<typename Executor>
void pipe_out<2,-1>::on_exec_setup(Executor &e) const
{
if (::dup2(descr_, STDERR_FILENO) == -1)
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
::close(descr_);
}
template<>
template<typename Executor>
void pipe_out<1,2>::on_exec_setup(Executor &e) const
{
if (::dup2(descr_, STDOUT_FILENO) == -1)
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
if (::dup2(descr_, STDERR_FILENO) == -1)
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
::close(descr_);
}
}}}}
#endif

View File

@@ -1,39 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_POSIX_SEARCH_PATH_HPP
#define BOOST_PROCESS_POSIX_SEARCH_PATH_HPP
#include <boost/process/detail/config.hpp>
#include <boost/filesystem.hpp>
#include <boost/tokenizer.hpp>
#include <string>
#include <stdexcept>
#include <stdlib.h>
#include <unistd.h>
namespace boost { namespace process { namespace detail { namespace posix {
inline boost::filesystem::path search_path(
const boost::filesystem::path &filename,
const std::vector<boost::filesystem::path> &path)
{
std::string result;
for (const boost::filesystem::path & pp : path)
{
auto p = pp / filename;
if (!::access(p.c_str(), X_OK))
return p;
}
return "";
}
}}}}
#endif

View File

@@ -1,157 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_POSIX_VARIANT_HPP_
#define BOOST_PROCESS_DETAIL_POSIX_VARIANT_HPP_
#include <boost/process/detail/posix/handler.hpp>
#include <boost/variant/variant.hpp>
#include <boost/variant/static_visitor.hpp>
namespace boost
{
namespace process
{
namespace detail
{
namespace posix
{
template<typename Executor>
struct on_setup_visitor : boost::static_visitor<void>
{
Executor & exec;
template<typename T>
void operator()(T &t)
{
t.on_setup(exec);
}
};
template<typename Executor>
struct on_error_visitor : boost::static_visitor<void>
{
Executor & exec;
const std::error_code &ec;
template<typename T>
void operator()(T &t)
{
t.on_error(exec, ec);
}
};
template<typename Executor>
struct on_success_visitor : boost::static_visitor<void>
{
Executor & exec;
template<typename T>
void operator()(T &t)
{
t.on_success(exec);
}
};
template<typename Executor>
struct on_fork_error_visitor : boost::static_visitor<void>
{
Executor & exec;
const std::error_code &ec;
template<typename T>
void operator()(T &t)
{
t.on_fork_error(exec, ec);
}
};
template<typename Executor>
struct on_exec_setup_visitor : boost::static_visitor<void>
{
Executor & exec;
template<typename T>
void operator()(T &t)
{
t.on_exec_setup(exec);
}
};
template<typename Executor>
struct on_exec_error_visitor : boost::static_visitor<void>
{
Executor & exec;
const std::error_code &ec;
template<typename T>
void operator()(T &t)
{
t.on_exec_error(exec, ec);
}
};
template<typename ...Args>
struct handler_variant : handler_base_ext, boost::variant<Args...>
{
using boost::variant<Args...>::variant;
using boost::variant<Args...>::operator=;
template <class Executor>
void on_setup(Executor& exec)
{
on_setup_visitor<Executor> vis{exec};
boost::apply_visitor(vis, *this);
}
template <class Executor>
void on_error(Executor& exec, const std::error_code & ec)
{
on_error_visitor<Executor> vis{exec, ec};
boost::apply_visitor(vis, *this);
}
template <class Executor>
void on_success(Executor& exec)
{
on_success_visitor<Executor> vis{exec};
boost::apply_visitor(vis, *this);
}
template<typename Executor>
void on_fork_error (Executor & exec, const std::error_code& ec)
{
on_fork_error_visitor<Executor> vis{exec, ec};
boost::apply_visitor(vis, *this);
}
template<typename Executor>
void on_exec_setup (Executor & exec)
{
on_exec_setup_visitor<Executor> vis{exec};
boost::apply_visitor(vis, *this);
}
template<typename Executor>
void on_exec_error (Executor & exec, const std::error_code& ec)
{
on_exec_error_visitor<Executor> vis{exec, ec};
boost::apply_visitor(vis, *this);
}
};
}
}
}
}
#endif

View File

@@ -1,209 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_DETAIL_POSIX_WAIT_FOR_EXIT_HPP
#define BOOST_PROCESS_DETAIL_POSIX_WAIT_FOR_EXIT_HPP
#include <boost/process/detail/config.hpp>
#include <boost/process/detail/posix/child_handle.hpp>
#include <system_error>
#include <sys/types.h>
#include <sys/wait.h>
namespace boost { namespace process { namespace detail { namespace posix {
inline void wait(const child_handle &p, int & exit_code)
{
pid_t ret;
int status;
do
{
ret = ::waitpid(p.pid, &status, 0);
} while (((ret == -1) && (errno == EINTR)) || (ret != -1 && !WIFEXITED(status)));
if (ret == -1)
boost::process::detail::throw_last_error("waitpid(2) failed");
exit_code = status;
}
inline void wait(const child_handle &p, int & exit_code, std::error_code &ec) noexcept
{
pid_t ret;
int status;
do
{
ret = ::waitpid(p.pid, &status, 0);
}
while (((ret == -1) && (errno == EINTR)) || (ret != -1 && !WIFEXITED(status)));
if (ret == -1)
ec = boost::process::detail::get_last_error();
else
{
ec.clear();
exit_code = status;
}
}
template< class Rep, class Period >
inline bool wait_for(
const child_handle &p,
int & exit_code,
const std::chrono::duration<Rep, Period>& rel_time)
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
auto time_out = start + rel_time;
bool time_out_occured = false;
do
{
ret = ::waitpid(p.pid, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
boost::process::detail::throw_last_error("waitpid(2) failed");
exit_code = status;
return !time_out_occured;
}
template< class Rep, class Period >
inline bool wait_for(
const child_handle &p,
int & exit_code,
const std::chrono::duration<Rep, Period>& rel_time,
std::error_code & ec) noexcept
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
auto time_out = start + rel_time;
bool time_out_occured = false;
do
{
ret = ::waitpid(p.pid, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
ec = boost::process::detail::get_last_error();
else
{
ec.clear();
exit_code = status;
}
return !time_out_occured;
}
template< class Rep, class Period >
inline bool wait_until(
const child_handle &p,
int & exit_code,
const std::chrono::duration<Rep, Period>& time_out)
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
bool time_out_occured = false;
do
{
ret = ::waitpid(p.pid, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
boost::process::detail::throw_last_error("waitpid(2) failed");
exit_code = status;
return !time_out_occured;
}
template< class Rep, class Period >
inline bool wait_until(
const child_handle &p,
int & exit_code,
const std::chrono::duration<Rep, Period>& time_out,
std::error_code & ec) noexcept
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
bool time_out_occured = false;
do
{
ret = ::waitpid(p.pid, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
ec = boost::process::detail::get_last_error();
else
{
ec.clear();
exit_code = status;
}
return !time_out_occured;
}
}}}}
#endif

View File

@@ -1,191 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_DETAIL_POSIX_WAIT_GROUP_HPP
#define BOOST_PROCESS_DETAIL_POSIX_WAIT_GROUP_HPP
#include <boost/process/detail/config.hpp>
#include <boost/process/detail/posix/group_handle.hpp>
#include <system_error>
#include <sys/types.h>
#include <sys/wait.h>
namespace boost { namespace process { namespace detail { namespace posix {
inline void wait(const group_handle &p)
{
pid_t ret;
int status;
do
{
ret = ::waitpid(-p.grp, &status, 0);
} while (((ret == -1) && (errno == EINTR)) || (ret != -1 && !WIFEXITED(status)));
if (ret == -1)
boost::process::detail::throw_last_error("waitpid(2) failed");
}
inline void wait(const group_handle &p, std::error_code &ec) noexcept
{
pid_t ret;
int status;
do
{
ret = ::waitpid(-p.grp, &status, 0);
}
while (((ret == -1) && (errno == EINTR)) || (ret != -1 && !WIFEXITED(status)));
if (ret == -1)
ec = boost::process::detail::get_last_error();
else
ec.clear();
}
template< class Rep, class Period >
inline bool wait_for(
const group_handle &p,
const std::chrono::duration<Rep, Period>& rel_time)
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
auto time_out = start + rel_time;
bool time_out_occured = false;
do
{
ret = ::waitpid(-p.grp, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
boost::process::detail::throw_last_error("waitpid(2) failed");
return !time_out_occured;
}
template< class Rep, class Period >
inline bool wait_for(
const group_handle &p,
const std::chrono::duration<Rep, Period>& rel_time,
std::error_code & ec) noexcept
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
auto time_out = start + rel_time;
bool time_out_occured = false;
do
{
ret = ::waitpid(-p.grp, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
ec = boost::process::detail::get_last_error();
else
ec.clear();
return !time_out_occured;
}
template< class Rep, class Period >
inline bool wait_until(
const group_handle &p,
const std::chrono::duration<Rep, Period>& time_out)
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
bool time_out_occured = false;
do
{
ret = ::waitpid(-p.grp, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
boost::process::detail::throw_last_error("waitpid(2) failed");
return !time_out_occured;
}
template< class Rep, class Period >
inline bool wait_until(
const group_handle &p,
const std::chrono::duration<Rep, Period>& time_out,
std::error_code & ec) noexcept
{
pid_t ret;
int status;
auto start = std::chrono::system_clock::now();
bool time_out_occured = false;
do
{
ret = ::waitpid(-p.grp, &status, WUNTRACED | WNOHANG);
if (std::chrono::system_clock::now() >= time_out)
{
time_out_occured = true;
break;
}
}
while (((ret == -1) && errno == EINTR) ||
((ret != -1) && !WIFEXITED(status)));
if (ret == -1)
ec = boost::process::detail::get_last_error();
else
ec.clear();
return !time_out_occured;
}
}}}}
#endif

View File

@@ -1,17 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_TRAITS_HPP_
#define BOOST_PROCESS_TRAITS_HPP_
#include <boost/process/detail/traits/decl.hpp>
#include <boost/process/detail/traits/async.hpp>
#include <boost/process/detail/traits/cmd_or_exe.hpp>
#include <boost/process/detail/traits/env.hpp>
#include <boost/process/detail/traits/error.hpp>
#include <boost/process/detail/traits/wchar_t.hpp>
#endif /* BOOST_PROCESS_TRAITS_HPP_ */

View File

@@ -1,33 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_TRAITS_DECL_HPP_
#define BOOST_PROCESS_DETAIL_TRAITS_DECL_HPP_
#include <boost/process/detail/config.hpp>
#include <system_error>
#include <boost/process/detail/traits/decl.hpp>
namespace boost { namespace process { namespace detail {
struct error_tag {};
template<>
struct make_initializer_t<error_tag>;
template<> struct initializer_tag_t<std::error_code> { typedef error_tag type;};
}}}
#endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */

View File

@@ -1,105 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_ASYNC_IN_HPP
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_ASYNC_IN_HPP
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/handle_info.hpp>
#include <boost/detail/winapi/error_codes.hpp>
#include <boost/asio/write.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/windows/async_handler.hpp>
#include <boost/process/detail/windows/asio_fwd.hpp>
#include <boost/process/async_pipe.hpp>
#include <memory>
#include <future>
namespace boost { namespace process { namespace detail { namespace windows {
template<typename Buffer>
struct async_in_buffer : ::boost::process::detail::windows::handler_base_ext,
::boost::process::detail::windows::require_io_service
{
Buffer & buf;
std::shared_ptr<std::promise<void>> promise;
async_in_buffer operator>(std::future<void> & fut)
{
promise = std::make_shared<std::promise<void>>();
fut = promise->get_future(); return std::move(*this);
}
std::shared_ptr<boost::process::async_pipe> pipe;
async_in_buffer(Buffer & buf) : buf(buf)
{
}
template <typename Executor>
inline void on_success(Executor &exec)
{
auto pipe = this->pipe;
if (this->promise)
{
auto promise = this->promise;
boost::asio::async_write(*pipe, buf,
[promise](const boost::system::error_code & ec, std::size_t)
{
if (ec && (ec.value() != ::boost::detail::winapi::ERROR_BROKEN_PIPE_))
{
std::error_code e(ec.value(), std::system_category());
promise->set_exception(std::make_exception_ptr(process_error(e)));
}
promise->set_value();
});
}
else
boost::asio::async_write(*pipe, buf,
[pipe](const boost::system::error_code&ec, std::size_t size){});
::boost::detail::winapi::CloseHandle(pipe->native_source());
this->pipe = nullptr;
}
template<typename Executor>
void on_error(Executor &, const std::error_code &) const
{
::boost::detail::winapi::CloseHandle(pipe->native_source());
}
template <typename WindowsExecutor>
void on_setup(WindowsExecutor &exec)
{
if (!pipe)
pipe = std::make_shared<boost::process::async_pipe>(get_io_service(exec.seq));
::boost::detail::winapi::HANDLE_ source_handle = std::move(*pipe).source().native_handle();
boost::detail::winapi::SetHandleInformation(source_handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
exec.startup_info.hStdInput = source_handle;
exec.startup_info.dwFlags |= boost::detail::winapi::STARTF_USESTDHANDLES_;
exec.inherit_handles = true;
}
};
}}}}
#endif

View File

@@ -1,176 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_ASYNC_OUT_HPP
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_ASYNC_OUT_HPP
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/handle_info.hpp>
#include <boost/asio/read.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/windows/asio_fwd.hpp>
#include <boost/detail/winapi/error_codes.hpp>
#include <istream>
#include <memory>
#include <exception>
#include <future>
namespace boost { namespace process { namespace detail { namespace windows {
template <typename Executor>
inline void apply_out_handles(Executor &e, void* handle, std::integral_constant<int, 1>, std::integral_constant<int, -1>)
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdOutput = handle;
e.startup_info.dwFlags |= ::boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
template <typename Executor>
inline void apply_out_handles(Executor &e, void* handle, std::integral_constant<int, 2>, std::integral_constant<int, -1>)
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdError = handle;
e.startup_info.dwFlags |= ::boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
template <typename Executor>
inline void apply_out_handles(Executor &e, void* handle, std::integral_constant<int, 1>, std::integral_constant<int, 2>)
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdOutput = handle;
e.startup_info.hStdError = handle;
e.startup_info.dwFlags |= ::boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
template<int p1, int p2, typename Buffer>
struct async_out_buffer : ::boost::process::detail::windows::handler_base_ext,
::boost::process::detail::windows::require_io_service
{
Buffer & buf;
std::shared_ptr<boost::process::async_pipe> pipe;
async_out_buffer(Buffer & buf) : buf(buf)
{
}
template <typename Executor>
inline void on_success(Executor &exec)
{
auto pipe = this->pipe;
boost::asio::async_read(*pipe, buf,
[pipe](const boost::system::error_code&, std::size_t size){});
::boost::detail::winapi::CloseHandle(pipe->native_sink());
this->pipe = nullptr;
}
template<typename Executor>
void on_error(Executor &, const std::error_code &) const
{
::boost::detail::winapi::CloseHandle(pipe->native_sink());
}
template <typename WindowsExecutor>
void on_setup(WindowsExecutor &exec)
{
if (!pipe)
pipe = std::make_shared<boost::process::async_pipe>(get_io_service(exec.seq));
apply_out_handles(exec, std::move(*pipe).sink().native_handle(),
std::integral_constant<int, p1>(), std::integral_constant<int, p2>());
}
};
template<int p1, int p2, typename Type>
struct async_out_future : ::boost::process::detail::windows::handler_base_ext,
::boost::process::detail::windows::require_io_service
{
std::shared_ptr<boost::process::async_pipe> pipe;
std::shared_ptr<std::promise<Type>> promise = std::make_shared<std::promise<Type>>();
std::shared_ptr<boost::asio::streambuf> buffer = std::make_shared<boost::asio::streambuf>();
async_out_future(std::future<Type> & fut)
{
fut = promise->get_future();
}
template <typename Executor>
inline void on_success(Executor &exec)
{
auto pipe = this->pipe;
auto buffer = this->buffer;
auto promise = this->promise;
::boost::detail::winapi::CloseHandle(pipe->native_sink());
boost::asio::async_read(*pipe, *buffer,
[pipe, buffer, promise](const boost::system::error_code& ec, std::size_t size)
{
if (ec && (ec.value() != ::boost::detail::winapi::ERROR_BROKEN_PIPE_))
{
std::error_code e(ec.value(), std::system_category());
promise->set_exception(std::make_exception_ptr(process_error(e)));
}
else
{
std::istream is (buffer.get());
Type arg;
arg.resize(buffer->size());
is.read(&*arg.begin(), buffer->size());
promise->set_value(std::move(arg));
}
});
this->pipe = nullptr;
this->buffer = nullptr;
this->promise = nullptr;
}
template<typename Executor>
void on_error(Executor &, const std::error_code &) const
{
::boost::detail::winapi::CloseHandle(pipe->native_sink());
}
template <typename WindowsExecutor>
void on_setup(WindowsExecutor &exec)
{
if (!pipe)
pipe = std::make_shared<boost::process::async_pipe>(get_io_service(exec.seq));
apply_out_handles(exec, std::move(*pipe).sink().native_handle(),
std::integral_constant<int, p1>(), std::integral_constant<int, p2>());
}
};
}}}}
#endif

View File

@@ -1,409 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_ASYNC_PIPE_HPP_
#define BOOST_PROCESS_DETAIL_WINDOWS_ASYNC_PIPE_HPP_
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/pipes.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/file_management.hpp>
#include <boost/detail/winapi/get_last_error.hpp>
#include <boost/detail/winapi/access_rights.hpp>
#include <boost/detail/winapi/process.hpp>
#include <boost/process/detail/windows/basic_pipe.hpp>
#include <boost/asio/windows/stream_handle.hpp>
#include <system_error>
#include <string>
namespace boost { namespace process { namespace detail { namespace windows {
inline std::string make_pipe_name()
{
std::string name = "\\\\.\\pipe\\boost_process_auto_pipe_";
auto pid = ::boost::detail::winapi::GetCurrentProcessId();
static unsigned long long cnt = 0;
name += std::to_string(pid);
name += "_";
name += std::to_string(cnt++);
return name;
}
class async_pipe
{
::boost::asio::windows::stream_handle _source;
::boost::asio::windows::stream_handle _sink ;
public:
typedef ::boost::detail::winapi::HANDLE_ native_handle_type;
typedef ::boost::asio::windows::stream_handle handle_type;
inline async_pipe(boost::asio::io_service & ios,
const std::string & name = make_pipe_name())
: async_pipe(ios, ios, name) {}
inline async_pipe(boost::asio::io_service & ios_source,
boost::asio::io_service & ios_sink,
const std::string & name = make_pipe_name());
inline async_pipe(const async_pipe& rhs);
async_pipe(async_pipe&& rhs) : _source(std::move(rhs._source)), _sink(std::move(rhs._sink))
{
rhs._source.assign (::boost::detail::winapi::INVALID_HANDLE_VALUE_);
rhs._sink .assign (::boost::detail::winapi::INVALID_HANDLE_VALUE_);
}
template<class CharT, class Traits = std::char_traits<CharT>>
explicit async_pipe(::boost::asio::io_service & ios_source,
::boost::asio::io_service & ios_sink,
const basic_pipe<CharT, Traits> & p)
: _source(ios_source, p.native_source()), _sink(ios_sink, p.native_sink())
{
}
template<class CharT, class Traits = std::char_traits<CharT>>
explicit async_pipe(boost::asio::io_service & ios, const basic_pipe<CharT, Traits> & p)
: async_pipe(ios, ios, p)
{
}
template<class CharT, class Traits = std::char_traits<CharT>>
inline async_pipe& operator=(const basic_pipe<CharT, Traits>& p);
inline async_pipe& operator=(const async_pipe& rhs);
inline async_pipe& operator=(async_pipe&& rhs);
~async_pipe()
{
if (_sink .native() != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_sink.native());
if (_source.native() != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_source.native());
}
template<class CharT, class Traits = std::char_traits<CharT>>
inline explicit operator basic_pipe<CharT, Traits>() const;
void cancel()
{
if (_sink.is_open())
_sink.cancel();
if (_source.is_open())
_source.cancel();
}
void close()
{
if (_sink.is_open())
{
_sink.close();
_sink.assign(::boost::detail::winapi::INVALID_HANDLE_VALUE_);
}
if (_source.is_open())
{
_source.close();
_source.assign(::boost::detail::winapi::INVALID_HANDLE_VALUE_);
}
}
void close(boost::system::error_code & ec)
{
if (_sink.is_open())
_sink.close(ec);
if (_source.is_open())
_source.close(ec);
}
bool is_open() const
{
return _sink.is_open() || _source.is_open();
}
void async_close()
{
if (_sink.is_open())
_sink.get_io_service(). post([this]{_sink.close();});
if (_source.is_open())
_source.get_io_service().post([this]{_source.close();});
}
template<typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence & buffers)
{
return _source.read_some(buffers);
}
template<typename MutableBufferSequence>
std::size_t write_some(const MutableBufferSequence & buffers)
{
return _sink.write_some(buffers);
}
native_handle_type native_source() const {return const_cast<boost::asio::windows::stream_handle&>(_source).native();}
native_handle_type native_sink () const {return const_cast<boost::asio::windows::stream_handle&>(_sink ).native();}
template<typename MutableBufferSequence,
typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(
ReadHandler, void(boost::system::error_code, std::size_t))
async_read_some(
const MutableBufferSequence & buffers,
ReadHandler &&handler)
{
_source.async_read_some(buffers, std::forward<ReadHandler>(handler));
}
template<typename ConstBufferSequence,
typename WriteHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(
WriteHandler, void(boost::system::error_code, std::size_t))
async_write_some(
const ConstBufferSequence & buffers,
WriteHandler && handler)
{
_sink.async_write_some(buffers, std::forward<WriteHandler>(handler));
}
const handle_type & sink () const & {return _sink;}
const handle_type & source() const & {return _source;}
handle_type && source() && { return std::move(_source); }
handle_type && sink() && { return std::move(_sink); }
handle_type source(::boost::asio::io_service& ios) &&
{
::boost::asio::windows::stream_handle stolen(ios, _source.native_handle());
_source.assign(::boost::detail::winapi::INVALID_HANDLE_VALUE_);
return stolen;
}
handle_type sink (::boost::asio::io_service& ios) &&
{
::boost::asio::windows::stream_handle stolen(ios, _sink.native_handle());
_sink.assign(::boost::detail::winapi::INVALID_HANDLE_VALUE_);
return stolen;
}
handle_type source(::boost::asio::io_service& ios) const &
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
::boost::detail::winapi::HANDLE_ source;
auto source_in = const_cast<handle_type&>(_source).native();
if (source_in == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, source_in, proc, &source, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
return ::boost::asio::windows::stream_handle(ios, source);
}
handle_type sink (::boost::asio::io_service& ios) const &
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
::boost::detail::winapi::HANDLE_ sink;
auto sink_in = const_cast<handle_type&>(_sink).native();
if (sink_in == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, sink_in, proc, &sink, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
return ::boost::asio::windows::stream_handle(ios, sink);
}
};
async_pipe::async_pipe(const async_pipe& p) :
_source(const_cast<handle_type&>(p._source).get_io_service()),
_sink (const_cast<handle_type&>(p._sink).get_io_service())
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
::boost::detail::winapi::HANDLE_ source;
::boost::detail::winapi::HANDLE_ sink;
//cannot get the handle from a const object.
auto source_in = const_cast<handle_type&>(p._source).native();
auto sink_in = const_cast<handle_type&>(p._sink).native();
if (source_in == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, source_in, proc, &source, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
if (sink_in == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, sink_in, proc, &sink, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
_source.assign(source);
_sink. assign(sink);
}
async_pipe::async_pipe(boost::asio::io_service & ios_source,
boost::asio::io_service & ios_sink,
const std::string & name) : _source(ios_source), _sink(ios_sink)
{
static constexpr int FILE_FLAG_OVERLAPPED_ = 0x40000000; //temporary
::boost::detail::winapi::HANDLE_ source = ::boost::detail::winapi::create_named_pipe(
name.c_str(),
::boost::detail::winapi::PIPE_ACCESS_INBOUND_
| FILE_FLAG_OVERLAPPED_, //write flag
0, 1, 8192, 8192, 0, nullptr);
if (source == boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::process::detail::throw_last_error("create_named_pipe(" + name + ") failed");
_source.assign(source);
::boost::detail::winapi::HANDLE_ sink = boost::detail::winapi::create_file(
name.c_str(),
::boost::detail::winapi::GENERIC_WRITE_, 0, nullptr,
::boost::detail::winapi::OPEN_EXISTING_,
FILE_FLAG_OVERLAPPED_, //to allow read
nullptr);
if (sink == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::process::detail::throw_last_error("create_file() failed");
_sink.assign(sink);
}
async_pipe& async_pipe::operator=(const async_pipe & p)
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
::boost::detail::winapi::HANDLE_ source;
::boost::detail::winapi::HANDLE_ sink;
//cannot get the handle from a const object.
auto &source_in = const_cast<::boost::asio::windows::stream_handle &>(p._source);
auto &sink_in = const_cast<::boost::asio::windows::stream_handle &>(p._sink);
if (source_in.native() == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, source_in.native(), proc, &source, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
if (sink_in.native() == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, sink_in.native(), proc, &sink, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
//so we also assign the io_service
_source = ::boost::asio::windows::stream_handle(source_in.get_io_service(), source);
_sink = ::boost::asio::windows::stream_handle(source_in.get_io_service(), sink);
return *this;
}
async_pipe& async_pipe::operator=(async_pipe && rhs)
{
if (_source.native_handle() != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_source.native());
if (_sink.native_handle() != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_sink.native());
_source.assign(rhs._source.native_handle());
_sink .assign(rhs._sink .native_handle());
rhs._source.assign(::boost::detail::winapi::INVALID_HANDLE_VALUE_);
rhs._sink .assign(::boost::detail::winapi::INVALID_HANDLE_VALUE_);
return *this;
}
template<class CharT, class Traits>
async_pipe::operator basic_pipe<CharT, Traits>() const
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
::boost::detail::winapi::HANDLE_ source;
::boost::detail::winapi::HANDLE_ sink;
//cannot get the handle from a const object.
auto source_in = const_cast<::boost::asio::windows::stream_handle &>(_source).native();
auto sink_in = const_cast<::boost::asio::windows::stream_handle &>(_sink).native();
if (source == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
_source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, source_in, proc, &source, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
if (sink == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
_sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, sink_in, proc, &sink, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
return {source, sink};
}
inline bool operator==(const async_pipe & lhs, const async_pipe & rhs)
{
return compare_handles(lhs.native_source(), rhs.native_source()) &&
compare_handles(lhs.native_sink(), rhs.native_sink());
}
inline bool operator!=(const async_pipe & lhs, const async_pipe & rhs)
{
return !compare_handles(lhs.native_source(), rhs.native_source()) ||
!compare_handles(lhs.native_sink(), rhs.native_sink());
}
template<class Char, class Traits>
inline bool operator==(const async_pipe & lhs, const basic_pipe<Char, Traits> & rhs)
{
return compare_handles(lhs.native_source(), rhs.native_source()) &&
compare_handles(lhs.native_sink(), rhs.native_sink());
}
template<class Char, class Traits>
inline bool operator!=(const async_pipe & lhs, const basic_pipe<Char, Traits> & rhs)
{
return !compare_handles(lhs.native_source(), rhs.native_source()) ||
!compare_handles(lhs.native_sink(), rhs.native_sink());
}
template<class Char, class Traits>
inline bool operator==(const basic_pipe<Char, Traits> & lhs, const async_pipe & rhs)
{
return compare_handles(lhs.native_source(), rhs.native_source()) &&
compare_handles(lhs.native_sink(), rhs.native_sink());
}
template<class Char, class Traits>
inline bool operator!=(const basic_pipe<Char, Traits> & lhs, const async_pipe & rhs)
{
return !compare_handles(lhs.native_source(), rhs.native_source()) ||
!compare_handles(lhs.native_sink(), rhs.native_sink());
}
}}}}
#endif /* INCLUDE_BOOST_PIPE_DETAIL_WINDOWS_ASYNC_PIPE_HPP_ */

View File

@@ -1,222 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_PIPE_HPP
#define BOOST_PROCESS_DETAIL_WINDOWS_PIPE_HPP
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/error_codes.hpp>
#include <boost/detail/winapi/pipes.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/file_management.hpp>
#include <boost/detail/winapi/get_last_error.hpp>
#include <boost/detail/winapi/access_rights.hpp>
#include <boost/detail/winapi/process.hpp>
#include <boost/process/detail/windows/compare_handles.hpp>
#include <system_error>
#include <string>
namespace boost { namespace process { namespace detail { namespace windows {
template<class CharT, class Traits = std::char_traits<CharT>>
class basic_pipe
{
::boost::detail::winapi::HANDLE_ _source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
::boost::detail::winapi::HANDLE_ _sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
public:
typedef CharT char_type ;
typedef Traits traits_type;
typedef typename Traits::int_type int_type ;
typedef typename Traits::pos_type pos_type ;
typedef typename Traits::off_type off_type ;
typedef ::boost::detail::winapi::HANDLE_ native_handle_type;
explicit basic_pipe(::boost::detail::winapi::HANDLE_ source, ::boost::detail::winapi::HANDLE_ sink)
: _source(source), _sink(sink) {}
inline explicit basic_pipe(const std::string & name);
inline basic_pipe(const basic_pipe& p);
basic_pipe(basic_pipe&& lhs) : _source(lhs._source), _sink(lhs._sink)
{
lhs._source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
lhs._sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
}
inline basic_pipe& operator=(const basic_pipe& p);
inline basic_pipe& operator=(basic_pipe&& lhs);
~basic_pipe()
{
if (_sink != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_sink);
if (_source != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_source);
}
native_handle_type native_source() const {return _source;}
native_handle_type native_sink () const {return _sink;}
basic_pipe()
{
if (!::boost::detail::winapi::CreatePipe(&_source, &_sink, nullptr, 0))
throw_last_error("CreatePipe() failed");
}
int_type write(const char_type * data, int_type count)
{
::boost::detail::winapi::DWORD_ write_len;
if (!::boost::detail::winapi::WriteFile(
_sink, data, count * sizeof(char_type), &write_len, nullptr
))
{
auto ec = ::boost::process::detail::get_last_error();
if ((ec.value() == ::boost::detail::winapi::ERROR_BROKEN_PIPE_) ||
(ec.value() == ::boost::detail::winapi::ERROR_NO_DATA_))
return 0;
else
throw process_error(ec, "WriteFile failed");
}
return static_cast<int_type>(write_len);
}
int_type read(char_type * data, int_type count)
{
::boost::detail::winapi::DWORD_ read_len;
if (!::boost::detail::winapi::ReadFile(
_source, data, count * sizeof(char_type), &read_len, nullptr
))
{
auto ec = ::boost::process::detail::get_last_error();
if ((ec.value() == ::boost::detail::winapi::ERROR_BROKEN_PIPE_) ||
(ec.value() == ::boost::detail::winapi::ERROR_NO_DATA_))
return 0;
else
throw process_error(ec, "ReadFile failed");
}
return static_cast<int_type>(read_len);
}
bool is_open()
{
return (_source != ::boost::detail::winapi::INVALID_HANDLE_VALUE_) ||
(_sink != ::boost::detail::winapi::INVALID_HANDLE_VALUE_);
}
void close()
{
::boost::detail::winapi::CloseHandle(_source);
::boost::detail::winapi::CloseHandle(_sink);
_source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
_sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
}
};
template<class Char, class Traits>
basic_pipe<Char, Traits>::basic_pipe(const basic_pipe & p)
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
if (p._source == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
_source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, p._source, proc, &_source, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
if (p._sink == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
_sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, p._sink, proc, &_sink, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
}
template<class Char, class Traits>
basic_pipe<Char, Traits>::basic_pipe(const std::string & name)
{
static constexpr int OPEN_EXISTING_ = 3; //temporary.
static constexpr int FILE_FLAG_OVERLAPPED_ = 0x40000000; //temporary
//static constexpr int FILE_ATTRIBUTE_NORMAL_ = 0x00000080; //temporary
::boost::detail::winapi::HANDLE_ source = ::boost::detail::winapi::create_named_pipe(
name.c_str(),
::boost::detail::winapi::PIPE_ACCESS_INBOUND_
| FILE_FLAG_OVERLAPPED_, //write flag
0, 1, 8192, 8192, 0, nullptr);
if (source == boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::process::detail::throw_last_error("create_named_pipe() failed");
::boost::detail::winapi::HANDLE_ sink = boost::detail::winapi::create_file(
name.c_str(),
::boost::detail::winapi::GENERIC_WRITE_, 0, nullptr,
OPEN_EXISTING_,
FILE_FLAG_OVERLAPPED_, //to allow read
nullptr);
if (sink == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::process::detail::throw_last_error("create_file() failed");
_source = source;
_sink = sink;
}
template<class Char, class Traits>
basic_pipe<Char, Traits>& basic_pipe<Char, Traits>::operator=(const basic_pipe & p)
{
auto proc = ::boost::detail::winapi::GetCurrentProcess();
if (p._source == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
_source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, p._source, proc, &_source, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
if (p._sink == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
_sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
else if (!::boost::detail::winapi::DuplicateHandle(
proc, p._sink, proc, &_sink, 0,
static_cast<::boost::detail::winapi::BOOL_>(true),
::boost::detail::winapi::DUPLICATE_SAME_ACCESS_))
throw_last_error("Duplicate Pipe Failed");
return *this;
}
template<class Char, class Traits>
basic_pipe<Char, Traits>& basic_pipe<Char, Traits>::operator=(basic_pipe && lhs)
{
if (_source != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_source);
if (_sink != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_sink);
_source = lhs._source;
_sink = lhs._sink;
lhs._source = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
lhs._sink = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
return *this;
}
template<class Char, class Traits>
inline bool operator==(const basic_pipe<Char, Traits> & lhs, const basic_pipe<Char, Traits> & rhs)
{
return compare_handles(lhs.native_source(), rhs.native_source()) &&
compare_handles(lhs.native_sink(), rhs.native_sink());
}
template<class Char, class Traits>
inline bool operator!=(const basic_pipe<Char, Traits> & lhs, const basic_pipe<Char, Traits> & rhs)
{
return !compare_handles(lhs.native_source(), rhs.native_source()) ||
!compare_handles(lhs.native_sink(), rhs.native_sink());
}
}}}}
#endif

View File

@@ -1,98 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_WINDOWS_CHILD_HPP
#define BOOST_PROCESS_WINDOWS_CHILD_HPP
#include <boost/move/move.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/jobs.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
typedef int pid_t;
struct child_handle
{
::boost::detail::winapi::PROCESS_INFORMATION_ proc_info{nullptr, nullptr, 0,0};
explicit child_handle(const ::boost::detail::winapi::PROCESS_INFORMATION_ &pi) :
proc_info(pi)
{}
explicit child_handle(pid_t pid) :
proc_info{nullptr, nullptr, 0,0}
{
auto h = ::boost::detail::winapi::OpenProcess(
::boost::detail::winapi::PROCESS_ALL_ACCESS_,
static_cast<::boost::detail::winapi::BOOL_>(1),
pid);
if (h == nullptr)
throw_last_error("OpenProcess() failed");
proc_info.hProcess = h;
proc_info.dwProcessId = pid;
}
child_handle() = default;
~child_handle()
{
::boost::detail::winapi::CloseHandle(proc_info.hProcess);
::boost::detail::winapi::CloseHandle(proc_info.hThread);
}
child_handle(const child_handle & c) = delete;
child_handle(child_handle && c) : proc_info(c.proc_info)
{
c.proc_info.hProcess = ::boost::detail::winapi::invalid_handle_value;
c.proc_info.hThread = ::boost::detail::winapi::invalid_handle_value;
}
child_handle &operator=(const child_handle & c) = delete;
child_handle &operator=(child_handle && c)
{
::boost::detail::winapi::CloseHandle(proc_info.hProcess);
::boost::detail::winapi::CloseHandle(proc_info.hThread);
proc_info = c.proc_info;
c.proc_info.hProcess = ::boost::detail::winapi::invalid_handle_value;
c.proc_info.hThread = ::boost::detail::winapi::invalid_handle_value;
return *this;
}
pid_t id() const
{
return static_cast<int>(proc_info.dwProcessId);
}
typedef ::boost::detail::winapi::HANDLE_ process_handle_t;
process_handle_t process_handle() const { return proc_info.hProcess; }
bool valid() const
{
return (proc_info.hProcess != nullptr) &&
(proc_info.hProcess != ::boost::detail::winapi::INVALID_HANDLE_VALUE_);
}
bool in_group() const
{
::boost::detail::winapi::BOOL_ value;
if (!::boost::detail::winapi::IsProcessInJob(proc_info.hProcess, nullptr, &value))
throw_last_error("IsProcessinJob Failed");
return value!=0;
}
bool in_group(std::error_code &ec) const noexcept
{
::boost::detail::winapi::BOOL_ value;
if (!::boost::detail::winapi::IsProcessInJob(proc_info.hProcess, nullptr, &value))
ec = get_last_error();
return value!=0;
}
};
}}}}
#endif

View File

@@ -1,41 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_COMPARE_HANDLES_HPP_
#define BOOST_PROCESS_DETAIL_WINDOWS_COMPARE_HANDLES_HPP_
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/file_management.hpp>
#include <boost/process/detail/config.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
inline bool compare_handles(boost::detail::winapi::HANDLE_ lhs, boost::detail::winapi::HANDLE_ rhs)
{
if ( (lhs == ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
|| (rhs == ::boost::detail::winapi::INVALID_HANDLE_VALUE_))
return false;
if (lhs == rhs)
return true;
::boost::detail::winapi::BY_HANDLE_FILE_INFORMATION_ lhs_info{0,0,0,0,0,0,0,0,0,0};
::boost::detail::winapi::BY_HANDLE_FILE_INFORMATION_ rhs_info{0,0,0,0,0,0,0,0,0,0};
if (!::boost::detail::winapi::GetFileInformationByHandle(lhs, &lhs_info))
::boost::process::detail::throw_last_error("GetFileInformationByHandle");
if (!::boost::detail::winapi::GetFileInformationByHandle(rhs, &rhs_info))
::boost::process::detail::throw_last_error("GetFileInformationByHandle");
return (lhs_info.nFileIndexHigh == rhs_info.nFileIndexHigh)
&& (lhs_info.nFileIndexLow == rhs_info.nFileIndexLow);
}
}}}}
#endif /* BOOST_PROCESS_DETAIL_WINDOWS_COMPARE_HANDLES_HPP_ */

View File

@@ -1,47 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_ENV_INIT_HPP_
#define BOOST_PROCESS_DETAIL_WINDOWS_ENV_INIT_HPP_
#include <boost/detail/winapi/error_codes.hpp>
#include <boost/process/detail/config.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/environment.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
template<typename Char>
struct env_init : public ::boost::process::detail::handler_base
{
boost::process::basic_environment<Char> env;
env_init(boost::process::basic_environment<Char> && env) : env(std::move(env)) {};
env_init(const boost::process::basic_environment<Char> & env) : env(env) {};
template <class WindowsExecutor>
void on_setup(WindowsExecutor &exec) const
{
auto e = env.native_handle();
if (*e == null_char<char>())
{
exec.set_error(std::error_code(::boost::detail::winapi::ERROR_BAD_ENVIRONMENT_, std::system_category()),
"Bad Environment");
}
exec.env = e;
}
};
}}}}
#endif /* BOOST_PROCESS_DETAIL_WINDOWS_ENV_INIT_HPP_ */

View File

@@ -1,104 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_FILE_DESCRIPTOR_HPP_
#define BOOST_PROCESS_DETAIL_WINDOWS_FILE_DESCRIPTOR_HPP_
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/file_management.hpp>
#include <string>
#include <boost/filesystem/path.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
struct file_descriptor
{
enum mode_t
{
read = 1,
write = 2,
read_write = 3
};
static ::boost::detail::winapi::DWORD_ desired_access(mode_t mode)
{
switch(mode)
{
case read:
return ::boost::detail::winapi::GENERIC_READ_;
case write:
return ::boost::detail::winapi::GENERIC_WRITE_;
case read_write:
return ::boost::detail::winapi::GENERIC_READ_
| ::boost::detail::winapi::GENERIC_WRITE_;
default:
return 0u;
}
}
file_descriptor() = default;
file_descriptor(const boost::filesystem::path& p, mode_t mode = read_write)
: file_descriptor(p.native(), mode)
{
}
file_descriptor(const std::string & path , mode_t mode = read_write)
: file_descriptor(path.c_str(), mode) {}
file_descriptor(const std::wstring & path, mode_t mode = read_write)
: file_descriptor(path.c_str(), mode) {}
file_descriptor(const char* path, mode_t mode = read_write)
: _handle(
::boost::detail::winapi::create_file(
path,
desired_access(mode),
::boost::detail::winapi::FILE_SHARE_READ_ |
::boost::detail::winapi::FILE_SHARE_WRITE_,
nullptr,
::boost::detail::winapi::OPEN_ALWAYS_,
::boost::detail::winapi::FILE_ATTRIBUTE_NORMAL_,
nullptr
))
{
}
file_descriptor(const wchar_t * path, mode_t mode = read_write)
: _handle(
::boost::detail::winapi::create_file(
path,
desired_access(mode),
::boost::detail::winapi::FILE_SHARE_READ_ |
::boost::detail::winapi::FILE_SHARE_WRITE_,
nullptr,
::boost::detail::winapi::OPEN_ALWAYS_,
::boost::detail::winapi::FILE_ATTRIBUTE_NORMAL_,
nullptr
))
{
}
file_descriptor(const file_descriptor & ) = delete;
file_descriptor(file_descriptor && ) = default;
file_descriptor& operator=(const file_descriptor & ) = delete;
file_descriptor& operator=(file_descriptor && ) = default;
~file_descriptor()
{
if (_handle != ::boost::detail::winapi::INVALID_HANDLE_VALUE_)
::boost::detail::winapi::CloseHandle(_handle);
}
::boost::detail::winapi::HANDLE_ handle() const { return _handle;}
private:
::boost::detail::winapi::HANDLE_ _handle = ::boost::detail::winapi::INVALID_HANDLE_VALUE_;
};
}}}}
#endif /* BOOST_PROCESS_DETAIL_WINDOWS_FILE_DESCRIPTOR_HPP_ */

View File

@@ -1,44 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_FILE_IN_HPP
#define BOOST_PROCESS_DETAIL_WINDOWS_FILE_IN_HPP
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/windows/file_descriptor.hpp>
#include <io.h>
namespace boost { namespace process { namespace detail { namespace windows {
struct file_in : public ::boost::process::detail::handler_base
{
file_descriptor file;
::boost::detail::winapi::HANDLE_ handle = file.handle();
template<typename T>
file_in(T&& t) : file(std::forward<T>(t), file_descriptor::read) {}
file_in(FILE * f) : handle(reinterpret_cast<::boost::detail::winapi::HANDLE_>(_get_osfhandle(_fileno(f)))) {}
template <class WindowsExecutor>
void on_setup(WindowsExecutor &e) const
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdInput = handle;
e.startup_info.dwFlags |= boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
};
}}}}
#endif

View File

@@ -1,64 +0,0 @@
// Copyright (c) 2106 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_WINDOWS_IS_RUNNING_HPP
#define BOOST_PROCESS_WINDOWS_IS_RUNNING_HPP
#include <boost/process/detail/config.hpp>
#include <system_error>
#include <cstdlib>
#include <boost/detail/winapi/process.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
constexpr static ::boost::detail::winapi::DWORD_ still_active = 259;
struct child_handle;
inline bool is_running(const child_handle &p, int & exit_code)
{
::boost::detail::winapi::DWORD_ code;
//single value, not needed in the winapi.
if (!::boost::detail::winapi::GetExitCodeProcess(p.process_handle(), &code))
::boost::process::detail::throw_last_error("GetExitCodeProcess() failed");
if (code == still_active)
return true;
else
{
exit_code = code;
return false;
}
}
inline bool is_running(const child_handle &p, int & exit_code, std::error_code &ec) noexcept
{
::boost::detail::winapi::DWORD_ code;
//single value, not needed in the winapi.
if (!::boost::detail::winapi::GetExitCodeProcess(p.process_handle(), &code))
ec = ::boost::process::detail::get_last_error();
else
ec.clear();
if (code == still_active)
return true;
else
{
exit_code = code;
return false;
}
}
inline bool is_running(int code)
{
return code == still_active;
}
inline int eval_exit_status(int in ) {return in;}
}}}}
#endif

View File

@@ -1,139 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_DETAIL_WINDOWS_JOB_WORKAROUND_HPP_
#define BOOST_PROCESS_DETAIL_WINDOWS_JOB_WORKAROUND_HPP_
#include <boost/detail/winapi/config.hpp>
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/dll.hpp>
namespace boost { namespace process { namespace detail { namespace windows { namespace workaround {
//this import workaround is to keep it a header-only library. and enums cannot be imported from the winapi.
extern "C"
{
typedef enum _JOBOBJECTINFOCLASS_ {
JobObjectBasicAccountingInformation_ = 1, JobObjectBasicLimitInformation_,
JobObjectBasicProcessIdList_, JobObjectBasicUIRestrictions_,
JobObjectSecurityLimitInformation_, JobObjectEndOfJobTimeInformation_,
JobObjectAssociateCompletionPortInformation_, JobObjectBasicAndIoAccountingInformation_,
JobObjectExtendedLimitInformation_, JobObjectJobSetInformation_,
JobObjectGroupInformation_,
JobObjectNotificationLimitInformation_,
JobObjectLimitViolationInformation_,
JobObjectGroupInformationEx_,
JobObjectCpuRateControlInformation_,
JobObjectCompletionFilter_,
JobObjectCompletionCounter_,
JobObjectReserved1Information_ = 18,
JobObjectReserved2Information_,
JobObjectReserved3Information_,
JobObjectReserved4Information_,
JobObjectReserved5Information_,
JobObjectReserved6Information_,
JobObjectReserved7Information_,
JobObjectReserved8Information_,
MaxJobObjectInfoClass_
} JOBOBJECTINFOCLASS_;
typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION_ {
::boost::detail::winapi::LARGE_INTEGER_ PerProcessUserTimeLimit;
::boost::detail::winapi::LARGE_INTEGER_ PerJobUserTimeLimit;
::boost::detail::winapi::DWORD_ LimitFlags;
::boost::detail::winapi::SIZE_T_ MinimumWorkingSetSize;
::boost::detail::winapi::SIZE_T_ MaximumWorkingSetSize;
::boost::detail::winapi::DWORD_ ActiveProcessLimit;
::boost::detail::winapi::ULONG_PTR_ Affinity;
::boost::detail::winapi::DWORD_ PriorityClass;
::boost::detail::winapi::DWORD_ SchedulingClass;
} JOBOBJECT_BASIC_LIMIT_INFORMATION_;
typedef struct _IO_COUNTERS_ {
::boost::detail::winapi::ULONGLONG_ ReadOperationCount;
::boost::detail::winapi::ULONGLONG_ WriteOperationCount;
::boost::detail::winapi::ULONGLONG_ OtherOperationCount;
::boost::detail::winapi::ULONGLONG_ ReadTransferCount;
::boost::detail::winapi::ULONGLONG_ WriteTransferCount;
::boost::detail::winapi::ULONGLONG_ OtherTransferCount;
} IO_COUNTERS_;
typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION_ {
JOBOBJECT_BASIC_LIMIT_INFORMATION_ BasicLimitInformation;
IO_COUNTERS_ IoInfo;
::boost::detail::winapi::SIZE_T_ ProcessMemoryLimit;
::boost::detail::winapi::SIZE_T_ JobMemoryLimit;
::boost::detail::winapi::SIZE_T_ PeakProcessMemoryUsed;
::boost::detail::winapi::SIZE_T_ PeakJobMemoryUsed;
} JOBOBJECT_EXTENDED_LIMIT_INFORMATION_;
/*BOOL WINAPI QueryInformationJobObject(
_In_opt_ HANDLE hJob,
_In_ JOBOBJECTINFOCLASS JobObjectInfoClass,
_Out_ LPVOID lpJobObjectInfo,
_In_ DWORD cbJobObjectInfoLength,
_Out_opt_ LPDWORD lpReturnLength
);
*/
typedef ::boost::detail::winapi::BOOL_ ( WINAPI *query_information_job_object_p)(
::boost::detail::winapi::HANDLE_,
JOBOBJECTINFOCLASS_,
void *,
::boost::detail::winapi::DWORD_,
::boost::detail::winapi::DWORD_ *);
inline ::boost::detail::winapi::BOOL_ WINAPI query_information_job_object(
::boost::detail::winapi::HANDLE_ hJob,
JOBOBJECTINFOCLASS_ JobObjectInfoClass,
void * lpJobObjectInfo,
::boost::detail::winapi::DWORD_ cbJobObjectInfoLength,
::boost::detail::winapi::DWORD_ *lpReturnLength)
{
static ::boost::detail::winapi::HMODULE_ h = ::boost::detail::winapi::get_module_handle("Kernel32.dll");
static query_information_job_object_p f = reinterpret_cast<query_information_job_object_p>(::boost::detail::winapi::get_proc_address(h, "QueryInformationJobObject"));
return (*f)(hJob, JobObjectInfoClass, lpJobObjectInfo, cbJobObjectInfoLength, lpReturnLength);
}
/*BOOL WINAPI SetInformationJobObject(
_In_ HANDLE hJob,
_In_ JOBOBJECTINFOCLASS JobObjectInfoClass,
_In_ LPVOID lpJobObjectInfo,
_In_ DWORD cbJobObjectInfoLength
);*/
typedef ::boost::detail::winapi::BOOL_ ( WINAPI *set_information_job_object_p)(
::boost::detail::winapi::HANDLE_,
JOBOBJECTINFOCLASS_,
void *,
::boost::detail::winapi::DWORD_);
}
inline ::boost::detail::winapi::BOOL_ WINAPI set_information_job_object(
::boost::detail::winapi::HANDLE_ hJob,
JOBOBJECTINFOCLASS_ JobObjectInfoClass,
void * lpJobObjectInfo,
::boost::detail::winapi::DWORD_ cbJobObjectInfoLength)
{
static ::boost::detail::winapi::HMODULE_ h = ::boost::detail::winapi::get_module_handle("Kernel32.dll");
static set_information_job_object_p f = reinterpret_cast<set_information_job_object_p>(::boost::detail::winapi::get_proc_address(h, "SetInformationJobObject"));
return (*f)(hJob, JobObjectInfoClass, lpJobObjectInfo, cbJobObjectInfoLength);
}
constexpr static ::boost::detail::winapi::DWORD_ JOB_OBJECT_LIMIT_BREAKAWAY_OK_ = 0x00000800;
}}}}}
#endif /* BOOST_PROCESS_DETAIL_WINDOWS_JOB_WORKAROUND_HPP_ */

View File

@@ -1,41 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_NULL_IN_HPP
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_NULL_IN_HPP
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/handle_info.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/windows/file_descriptor.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
struct null_in : public ::boost::process::detail::handler_base
{
file_descriptor source{"NUL", file_descriptor::read};
public:
template <class WindowsExecutor>
void on_setup(WindowsExecutor &e) const
{
boost::detail::winapi::SetHandleInformation(source.handle(),
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdInput = source.handle();
e.startup_info.dwFlags |= boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
};
}}}}
#endif

View File

@@ -1,41 +0,0 @@
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_WINDOWS_ON_EXIT_HPP_
#define BOOST_PROCESS_WINDOWS_ON_EXIT_HPP_
#include <boost/process/detail/config.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <boost/process/detail/windows/async_handler.hpp>
#include <boost/detail/winapi/process.hpp>
#include <system_error>
#include <functional>
namespace boost { namespace process { namespace detail { namespace windows {
struct on_exit_ : boost::process::detail::windows::async_handler
{
std::function<void(int, const std::error_code&)> handler;
on_exit_(const std::function<void(int, const std::error_code&)> & handler) : handler(handler)
{
}
template<typename Executor>
std::function<void(int, const std::error_code&)> on_exit_handler(Executor & exec)
{
auto handler = this->handler;
::boost::detail::winapi::PROCESS_INFORMATION_ & proc = exec.proc_info;
auto process_handle = proc.hProcess;
return [handler, process_handle](int exit_code, const std::error_code & ec)
{
handler(static_cast<int>(exit_code), ec);
};
}
};
}}}}
#endif /* INCLUDE_BOOST_PROCESS_WINDOWS_ON_EXIT_HPP_ */

View File

@@ -1,52 +0,0 @@
// 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)
#ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_PIPE_IN_HPP
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_PIPE_IN_HPP
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/process/detail/handler_base.hpp>
#include <cstdio>
namespace boost { namespace process { namespace detail { namespace windows {
struct pipe_in : public ::boost::process::detail::handler_base
{
::boost::detail::winapi::HANDLE_ handle;
template<typename T>
pipe_in(const T & p) : handle(p.native_source()) {}
template <class WindowsExecutor>
void on_setup(WindowsExecutor &e) const
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdInput = handle;
e.startup_info.dwFlags |= boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
template<typename WindowsExecutor>
void on_error(WindowsExecutor &, const std::error_code &) const
{
::boost::detail::winapi::CloseHandle(handle);
}
template<typename WindowsExecutor>
void on_success(WindowsExecutor &) const
{
::boost::detail::winapi::CloseHandle(handle);
}
};
}}}}
#endif

View File

@@ -1,87 +0,0 @@
// 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
// Copyright (c) 2016 Klemens D. Morgenstern
//
// 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)
#ifndef BOOST_PROCESS_WINDOWS_PIPE_OUT_HPP
#define BOOST_PROCESS_WINDOWS_PIPE_OUT_HPP
#include <boost/detail/winapi/process.hpp>
#include <boost/detail/winapi/handles.hpp>
#include <boost/process/detail/handler_base.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
template<int p1, int p2>
struct pipe_out : public ::boost::process::detail::handler_base
{
::boost::detail::winapi::HANDLE_ handle;
template<typename T>
pipe_out(const T & p) : handle(p.native_sink()) {}
template<typename WindowsExecutor>
void on_setup(WindowsExecutor &e) const;
template<typename WindowsExecutor>
void on_error(WindowsExecutor &, const std::error_code &) const
{
::boost::detail::winapi::CloseHandle(handle);
}
template<typename WindowsExecutor>
void on_success(WindowsExecutor &) const
{
::boost::detail::winapi::CloseHandle(handle);
}
};
template<>
template<typename WindowsExecutor>
void pipe_out<1,-1>::on_setup(WindowsExecutor &e) const
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdOutput = handle;
e.startup_info.dwFlags |= ::boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
template<>
template<typename WindowsExecutor>
void pipe_out<2,-1>::on_setup(WindowsExecutor &e) const
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdError = handle;
e.startup_info.dwFlags |= ::boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
template<>
template<typename WindowsExecutor>
void pipe_out<1,2>::on_setup(WindowsExecutor &e) const
{
boost::detail::winapi::SetHandleInformation(handle,
boost::detail::winapi::HANDLE_FLAG_INHERIT_,
boost::detail::winapi::HANDLE_FLAG_INHERIT_);
e.startup_info.hStdOutput = handle;
e.startup_info.hStdError = handle;
e.startup_info.dwFlags |= ::boost::detail::winapi::STARTF_USESTDHANDLES_;
e.inherit_handles = true;
}
}}}}
#endif

Some files were not shown because too many files have changed in this diff Show More