mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-21 21:33:54 +00:00
Use custom type for deleter.
This commit is contained in:
parent
131ab00304
commit
f3e18da416
@ -444,7 +444,12 @@ std::string final_path_component(const std::string &path) {
|
||||
Executes @c command and returns its STDOUT.
|
||||
*/
|
||||
std::string system_get(const char *command) {
|
||||
std::unique_ptr<FILE, decltype((pclose))> pipe(popen(command, "r"), pclose);
|
||||
struct pcloser {
|
||||
void operator()(FILE *file) {
|
||||
pclose(dir);
|
||||
}
|
||||
};
|
||||
std::unique_ptr<FILE, pcloser> pipe(popen(command, "r"));
|
||||
if(!pipe) return "";
|
||||
|
||||
std::string result;
|
||||
|
Loading…
Reference in New Issue
Block a user