Comments (5)
The warning shouldn't be there (anymore). The pipe-sink is closed on the parent side, so there won't be any deadlock.
Nm also writes out an empty line at the end, so it would be fine otherwise.
from process.
Thanks. maybe i misunderstood something, this routine:
- c.runing() = true
- (nm exited...)
- std::getline(is, line) ---> is it safe?
because there is a tutorial warning
Warning
--
The pipe will cause a deadlock if you try to read after nm exited
from process.
Then the loop condition isn't fulfilled and child.wait reaps the zombie process from the table.
from process.
Thanks.
from process.
@klemens-morgenstern But aren't FAQ is incorrect too?
[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 automatic pipe-closing in this library, because
a pipe might be a file-handle (as for async pipes on windows).]
The example code does not deadlock anymore too.
from process.
Related Issues (20)
- `boost::process::child`: `std::error_code` versus `exit_code()` HOT 1
- `boost::process::shell` documentation lacking HOT 2
- Process v2 and process_environment does not link. HOT 4
- [v2] error: overloaded process constructor if passing an executor HOT 2
- [v2] vfork_launcher undefined behaviour HOT 1
- Is it possible to add support for string_view? HOT 2
- boost::system::error_code not included in pipe_in/pipe_out when BOOST_PROCESS_USE_STD_FS is defined
- Process V2: Example fails to build when using BOOST_ASIO_SEPARATE_COMPILATION HOT 2
- Setting the capacity of the underline pipe. Linux only HOT 4
- Missing dependency on scope_exit with CMake build
- bp::environment::native_handle() cannot be compiled on Linux HOT 1
- Including boost/process.hpp causes build failure on Windows HOT 8
- [v2] Using async_execute with bind_cancellation_slot HOT 7
- Is it a typo mistake for "tempalte" in environment.hpp ?
- clang-15 error: expected unqualified-id due to dirfd macro in macOS 14 SDK
- clang-10 warning: comparison of integers of different signs: 'typename iterator_traits<__wrap_iter<char *> >::difference_type' (aka 'long') and 'const std::size_t' (aka 'const unsigned long')
- [Linux] boost::process:: child ::wait_until is not thread-safe HOT 6
- Boost CMake testing procedure doesn't work for Process
- [v2][Linux] process_is_running() returns false with musl libc
- boost\process\pipe.hpp(132,5): warning C4297: 'boost::process::basic_pipebuf<char,std::char_traits<char>>::~basic_pipebuf': function assumed not to throw an exception but does
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from process.