mirror of
https://github.com/boostorg/process.git
synced 2026-01-20 04:42:24 +00:00
Compare commits
3 Commits
xproc
...
origin/xpr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4ba43e970 | ||
|
|
19212708e5 | ||
|
|
42ba48f744 |
@@ -92,12 +92,13 @@ struct make_cmd_shell_
|
||||
str_lengths += (std::strlen(*c) + 1);
|
||||
}
|
||||
// yes, not the greatest solution.
|
||||
std::string buffer;
|
||||
res.buffer_.resize(str_lengths);
|
||||
|
||||
res.argv_ = new char*[res.argc_ + 1];
|
||||
res.free_argv_ = +[](int argc, char ** argv) {delete[] argv;};
|
||||
res.argv_[res.argc_] = nullptr;
|
||||
auto p = &*res.buffer_.begin();
|
||||
auto p = &buffer[sizeof(int) * (res.argc_) + 1];
|
||||
|
||||
for (int i = 0; i < res.argc_; i++)
|
||||
{
|
||||
@@ -304,8 +305,9 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return {};
|
||||
}
|
||||
|
||||
auto res = make_cmd_shell_::clone(cmd);
|
||||
procstat_freeargv(proc_stat.get());
|
||||
procstat_freeargv(proc_stat);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
auto eno = reinterpret_cast<char**>(out);
|
||||
auto eeo = eno;
|
||||
auto str = out + (n * sizeof(char*)) + sizeof(char*);
|
||||
auto str = out + (n * sizeof(char*)) + sizeof(char*);
|
||||
e = env;
|
||||
while (*e != nullptr)
|
||||
{
|
||||
@@ -351,11 +351,11 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
|
||||
*eno = str;
|
||||
str += len;
|
||||
eno ++;
|
||||
e++;
|
||||
}
|
||||
*eno = nullptr;
|
||||
|
||||
ev.handle_.reset(eeo);
|
||||
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
|
||||
@@ -115,7 +115,7 @@ void shell::parse_()
|
||||
|
||||
shell::~shell()
|
||||
{
|
||||
if (argv_ != nullptr && free_argv_ != nullptr)
|
||||
if (argv_ != nullptr && free_argv_)
|
||||
free_argv_(argc_, argv_);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user