poac-dev / poac

A package manager and build system for C++
https://poac.dev
Apache License 2.0
1.12k stars 73 forks source link

Use `execve` instead of `std::system` #970

Open ken-matsui opened 1 month ago

ken-matsui commented 1 month ago

https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152177

We may want to implement a Command class to hide this complexity, like Rust's std::process::Command.

The only location we use std::system is currently the following (instead of taking std::string_view, let's take the Command class):

https://github.com/poac-dev/poac/blob/7c4f62ef0902c763571cff39576c46c2bccb8827/src/Algos.cc#L44

After addressing this, we can enable cert-env33-c in clang-tidy:

https://github.com/poac-dev/poac/blob/7c4f62ef0902c763571cff39576c46c2bccb8827/.clang-tidy#L14

zimirza commented 1 week ago

I hope it is alright if I started to implement an abstraction for std::system (not yet complete). This is how it could be used: Command("cd").arg("poac").output()

ken-matsui commented 1 week ago

That's great to hear, thank you for working on this!

ken-matsui commented 1 week ago

However, we would like to avoid using malloc family directly. Instead, let's use higher-level libraries, such as std::string.

zimirza commented 6 days ago

Sure, I have refactored it to use std::string. I can create a draft pull request.