boostorg / boostorg/process

std_out/std_err keywords overloads accept `std::vector<char>` by implicit conversion to `boost::filesystem::path`

Open
#37 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

std_out/std_err keywords overloads accept `std::vector` by implicit conversion to `boost::filesystem::path`.

This is completely surprising, because

std::vector output;
bp::child(command, bp::std_out > output);

compiles and will be expected to do the equivalent of

std::future> output;
boost::asio::io_service io;
bp::child(command, bp::std_out > output, io);

However, hard to diagnose errors arise.

> A secondary issue might be that if the `dup2` call fails (which it does) that **doesn't stop de child process from running**. This has lead to me not diagnosing this exact error for 3 weeks¹, until I finally noticed my oversight²

¹ due to this SO answer: https://stackoverflow.com/questions/49139875/boostprocess-with-standard-output-redirection-fails-randomly-with-ubuntu-16/49140495

² due to making the same error in this SO answer https://stackoverflow.com/questions/49462992/how-to-test-an-instance-counter-by-asynchronous-run-of-a-boost-childprocess

## Reason

`std::vector` converts to `path` implicitly:

std::vector processOutput;
boost::filesystem::path p = processOutput;

We might want to rule out implicit conversions by going through a dispatch template.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.