From 3a9d6c26ed739d607775882929cac3bd17d10712 Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Sat, 18 Apr 2020 03:01:23 +0800 Subject: [PATCH] Redirect using freopen --- comfortable_swipe/service/restart.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/comfortable_swipe/service/restart.cpp b/comfortable_swipe/service/restart.cpp index c632a4f..2804c23 100644 --- a/comfortable_swipe/service/restart.cpp +++ b/comfortable_swipe/service/restart.cpp @@ -20,9 +20,7 @@ along with this program. If not, see . */ -#include // popen, pclose -#include // std::unique_ptr -#include // std::system +#include // freopen, stdout #include "../all_headers.hpp" namespace comfortable_swipe::service @@ -32,10 +30,12 @@ namespace comfortable_swipe::service */ void restart() { - // stop, while redirecting stdout to pipe - std::unique_ptr pipe(popen(__COMFORTABLE_SWIPE__PROGRAM__ " stop", "r"), pclose); + // dont show stdout on stop + freopen("/dev/null", "a", stdout); + comfortable_swipe::service::stop(); - // restart service + // show back on start + freopen ("/dev/tty", "a", stdout); comfortable_swipe::service::start(); } }