diff --git a/doc/reference/bind_launcher.adoc b/doc/reference/bind_launcher.adoc index 997a7953..9467129b 100644 --- a/doc/reference/bind_launcher.adoc +++ b/doc/reference/bind_launcher.adoc @@ -12,4 +12,5 @@ auto bind_launcher(Launcher && launcher, Init && ... init); // The new launcher with bound paramaters template auto bind_default_launcher(Init && ... init); ----- \ No newline at end of file +---- + diff --git a/doc/stdio.adoc b/doc/stdio.adoc index e0f0f7dc..8c0e611c 100644 --- a/doc/stdio.adoc +++ b/doc/stdio.adoc @@ -42,9 +42,11 @@ 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` returning that native handle type is valid, too. +Furthermore, any object that has a `native_handle` function which returns a valid type for a stdio stream. -.example/stdio.cpp:51-56 +E.g. a domain socket on linux. + +.example/stdio.cpp:52-57 [source,cpp] ---- include::../example/stdio.cpp[tag=native_handle] @@ -55,7 +57,7 @@ include::../example/stdio.cpp[tag=native_handle] 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:61-64 +.example/stdio.cpp:63-66 [source,cpp] ---- include::../example/stdio.cpp[tag=popen] diff --git a/example/stdio.cpp b/example/stdio.cpp index 97a2bf42..16264062 100644 --- a/example/stdio.cpp +++ b/example/stdio.cpp @@ -46,6 +46,7 @@ int main(int argc, char *argv[]) proc.wait(); //end::null[] } +#if defined(BOOST_POSIX_API) { //tag::native_handle[] asio::io_context ctx; @@ -56,6 +57,7 @@ int main(int argc, char *argv[]) proc.wait(); //end::native_handle[] } +#endif { //tag::popen[] asio::io_context ctx; diff --git a/include/boost/process/v2/stdio.hpp b/include/boost/process/v2/stdio.hpp index 72d6152a..ddd4fcea 100644 --- a/include/boost/process/v2/stdio.hpp +++ b/include/boost/process/v2/stdio.hpp @@ -82,11 +82,11 @@ struct process_io_binding process_io_binding() = default; template - process_io_binding(Stream && str, decltype(std::declval().native_handle()) = {}) + process_io_binding(Stream && str, decltype(std::declval().native_handle())* = nullptr) : process_io_binding(str.native_handle()) {} - process_io_binding(FILE * f) : process_io_binding(::_get_osfhandle(_fileno(f))) {} + process_io_binding(FILE * f) : process_io_binding(reinterpret_cast(::_get_osfhandle(_fileno(f)))) {} process_io_binding(HANDLE h) : h{h, get_flags(h)} {} process_io_binding(std::nullptr_t) : process_io_binding(filesystem::path("NUL")) {} template::value>::type> @@ -168,7 +168,7 @@ struct process_io_binding process_io_binding() = default; template - process_io_binding(Stream && str, decltype(std::declval().native_handle()) = {}) + process_io_binding(Stream && str, decltype(std::declval().native_handle()) * = nullptr) : process_io_binding(str.native_handle()) {}