commit 0e22e81b1e952e13534d7e5068be57a4d8396d87
parent 5b8eb5f7b146db4a2089fe1ca96b243a5c471e84
Author: torrinfail <torrinfail@gmail.com>
Date: Thu, 24 Dec 2020 16:53:26 -0700
Merge pull request #39 from Strahinja/master
Add the call to pclose() when the output from the block command is empty
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dwmblocks.c b/dwmblocks.c
@@ -65,8 +65,11 @@ void getcmd(const Block *block, char *output)
int i = strlen(block->icon);
fgets(output+i, CMDLENGTH-i-delimLen, cmdf);
i = strlen(output);
- if (i == 0)//return if block and command output are both empty
+ if (i == 0) {
+ //return if block and command output are both empty
+ pclose(cmdf);
return;
+ }
if (delim[0] != '\0') {
//only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i;