From 0740382851cd8bcb49004746acf2c99acdbbc385 Mon Sep 17 00:00:00 2001 From: Brice Waegeneire Date: Tue, 18 Jun 2019 11:53:56 +0200 Subject: [PATCH] fix(msg): use stdout when exiting with code 0 --- src/ipc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ipc.cpp b/src/ipc.cpp index 7252da40..951ab18f 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -15,8 +15,8 @@ using namespace std; #define IPC_CHANNEL_PREFIX "/tmp/polybar_mqueue." #endif -void log(const string& msg) { - fprintf(stderr, "polybar-msg: %s\n", msg.c_str()); +void display(const string& msg) { + fprintf(stdout, "%s\n", msg.c_str()); } void log(int exit_code, const string& msg) { @@ -33,7 +33,7 @@ void remove_pipe(const string& handle) { if (unlink(handle.c_str()) == -1) { log(1, "Could not remove stale ipc channel: "s + strerror(errno)); } else { - log("Removed stale ipc channel: " + handle); + display("Removed stale ipc channel: " + handle); } } @@ -120,7 +120,7 @@ int main(int argc, char** argv) { file_descriptor fd(channel, O_WRONLY | O_NONBLOCK); string payload{ipc_type + ':' + ipc_payload}; if (write(fd, payload.c_str(), payload.size()) != -1) { - log("Successfully wrote \"" + payload + "\" to \"" + channel + "\""); + display("Successfully wrote \"" + payload + "\" to \"" + channel + "\""); exit_status = 0; } else { log(E_WRITE, "Failed to write \"" + payload + "\" to \"" + channel + "\" (err: " + strerror(errno) + ")");