Boost Process 1.71 不再查看环境路径
Boost Process 1.71 does not look in environment path anymore
我一直在用boost 1.65,没改代码,更新boost到1.71版本,现在突然boost::process::child("command-in-path")
不继承执行进程的环境。我怎样才能恢复行为,是否可以不用每次都解析命令来在路径中找到可执行文件?
我还没有检查行为是否真的改变了,但我知道有一种方法可以明确允许 Boost 搜索路径:
Keep in mind that searching the path can easily be a security issue because it can be compromised, or attackers can leverage knowledge of the path setting to intercept executables. This is why you'd expect search_path
to be OFF by default (except for the system
interface, which is traditionally insecure)
#include <boost/process.hpp>
int main() {
namespace bp = boost::process;
bp::child c(
bp::search_path("date"),
std::vector<std::string> { "+%s" });
c.wait();
}
我一直在用boost 1.65,没改代码,更新boost到1.71版本,现在突然boost::process::child("command-in-path")
不继承执行进程的环境。我怎样才能恢复行为,是否可以不用每次都解析命令来在路径中找到可执行文件?
我还没有检查行为是否真的改变了,但我知道有一种方法可以明确允许 Boost 搜索路径:
Keep in mind that searching the path can easily be a security issue because it can be compromised, or attackers can leverage knowledge of the path setting to intercept executables. This is why you'd expect
search_path
to be OFF by default (except for thesystem
interface, which is traditionally insecure)
#include <boost/process.hpp>
int main() {
namespace bp = boost::process;
bp::child c(
bp::search_path("date"),
std::vector<std::string> { "+%s" });
c.wait();
}