Fix: Extra newline added for no reason.

This commit is contained in:
Jacob 2023-12-04 17:57:18 +01:00
parent 11aee2ab21
commit 9c25a04ebe

View file

@ -217,8 +217,14 @@ std::string spmenu::Run(spmenu::spmenuSettings *settings) {
}
while (fgets(buf.data(), buf.size(), pipe.get()) != NULL) {
size_t len = strlen(buf.data());
if (len > 0 && buf[len - 1] == '\n') {
ret += std::string(buf.data(), len - 1);
} else {
ret += buf.data();
}
}
return ret;
}