fix(custom): failed getline after closed pipe

This commit is contained in:
Alexis 2018-12-08 13:57:56 +01:00
parent 1b13f9e38c
commit 0acc50264e

View File

@ -54,8 +54,10 @@ void waybar::modules::Custom::continuousWorker()
char* buff = nullptr;
size_t len = 0;
if (getline(&buff, &len, fp_) == -1) {
pclose(fp_);
fp_ = nullptr;
if (fp_) {
pclose(fp_);
fp_ = nullptr;
}
thread_.stop();
output_ = { 1, "" };
std::cerr << name_ + " just stopped, is it endless?" << std::endl;