From 94858c63feb352967dd69ab13e945863d5bc0ef5 Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Sat, 18 Apr 2020 02:54:14 +0800 Subject: [PATCH] Redirect restart command to null --- comfortable_swipe/service/restart.cpp | 9 ++++++++- comfortable_swipe/service/stop.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/comfortable_swipe/service/restart.cpp b/comfortable_swipe/service/restart.cpp index 51c7495..c632a4f 100644 --- a/comfortable_swipe/service/restart.cpp +++ b/comfortable_swipe/service/restart.cpp @@ -19,6 +19,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +#include // popen, pclose +#include // std::unique_ptr +#include // std::system #include "../all_headers.hpp" namespace comfortable_swipe::service @@ -28,7 +32,10 @@ namespace comfortable_swipe::service */ void restart() { - comfortable_swipe::service::stop(); + // stop, while redirecting stdout to pipe + std::unique_ptr pipe(popen(__COMFORTABLE_SWIPE__PROGRAM__ " stop", "r"), pclose); + + // restart service comfortable_swipe::service::start(); } } diff --git a/comfortable_swipe/service/stop.cpp b/comfortable_swipe/service/stop.cpp index 6fb81af..5da375f 100644 --- a/comfortable_swipe/service/stop.cpp +++ b/comfortable_swipe/service/stop.cpp @@ -68,7 +68,7 @@ namespace comfortable_swipe::service } else { - std::puts("No program to stop"); + std::printf("No program to stop\n"); } } }