From b78a36fb0df4068ac6c3199746d658822613a2ff Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 6 Jun 2019 11:40:20 +0300
Subject: [PATCH] Clean shutdown for #54

---
 components/control/cpp/src/slave.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/components/control/cpp/src/slave.cpp b/components/control/cpp/src/slave.cpp
index fb30b8d2b..8485c825e 100644
--- a/components/control/cpp/src/slave.cpp
+++ b/components/control/cpp/src/slave.cpp
@@ -13,12 +13,15 @@ static void netLog(void* user_data, const loguru::Message& message) {
 Slave::Slave(Universe *net, ftl::Configurable *root) {
 	net->bind("restart", []() {
 		LOG(WARNING) << "Remote restart...";
-		exit(1);
+		//exit(1);
+		ftl::exit_code = 1;
+		ftl::running = false;
 	});
 
 	net->bind("shutdown", []() {
 		LOG(WARNING) << "Remote shutdown...";
-		exit(0);
+		//exit(0);
+		ftl::running = false;
 	});
 
 	net->bind("update_cfg", [](const std::string &uri, const std::string &value) {
-- 
GitLab