Browse Source

make debugfs exit on sigpipe (#16569)

* debugfs exit on sigpipe

* return 1 on sigpipe
Ilya Mashchenko 1 year ago
parent
commit
687b19fa39
1 changed files with 7 additions and 0 deletions
  1. 7 0
      collectors/debugfs.plugin/debugfs_plugin.c

+ 7 - 0
collectors/debugfs.plugin/debugfs_plugin.c

@@ -235,6 +235,13 @@ int main(int argc, char **argv)
             netdata_log_info("all modules are disabled, exiting...");
             return 1;
         }
+
+        fprintf(stdout, "\n");
+        fflush(stdout);
+        if (ferror(stdout) && errno == EPIPE) {
+            netdata_log_error("error writing to stdout: EPIPE. Exiting...");
+            return 1;
+        }
     }
 
     fprintf(stdout, "EXIT\n");