mirror of
https://github.com/boostorg/process.git
synced 2026-01-19 04:22:15 +00:00
windows fixes.
This commit is contained in:
@@ -12,4 +12,5 @@ auto bind_launcher(Launcher && launcher, Init && ... init);
|
||||
// The new launcher with bound paramaters
|
||||
template<typename ... Init>
|
||||
auto bind_default_launcher(Init && ... init);
|
||||
----
|
||||
----
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -82,11 +82,11 @@ struct process_io_binding
|
||||
process_io_binding() = default;
|
||||
|
||||
template<typename Stream>
|
||||
process_io_binding(Stream && str, decltype(std::declval<Stream>().native_handle()) = {})
|
||||
process_io_binding(Stream && str, decltype(std::declval<Stream>().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<HANDLE>(::_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<typename T, typename = typename std::enable_if<std::is_same<T, filesystem::path>::value>::type>
|
||||
@@ -168,7 +168,7 @@ struct process_io_binding
|
||||
process_io_binding() = default;
|
||||
|
||||
template<typename Stream>
|
||||
process_io_binding(Stream && str, decltype(std::declval<Stream>().native_handle()) = {})
|
||||
process_io_binding(Stream && str, decltype(std::declval<Stream>().native_handle()) * = nullptr)
|
||||
: process_io_binding(str.native_handle())
|
||||
{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user