From bf0da9f2f778aeb3eebe200a8cdeecbc6e1f9253 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 10 Dec 2013 15:30:53 -0800 Subject: Rest of software updater, ready to test... --- main.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 872fd37c..37d82bc8 100644 --- a/main.cpp +++ b/main.cpp @@ -44,6 +44,7 @@ #else #include #include +#include #include #include #include @@ -473,13 +474,21 @@ int main(int argc,char **argv) try { node = new Node(homeDir,port,controlPort); - const char *termReason = (char *)0; switch(node->run()) { - case Node::NODE_UNRECOVERABLE_ERROR: + case Node::NODE_NODE_RESTART_FOR_UPGRADE: { +#ifdef __UNIX_LIKE__ + const char *upgPath = node->reasonForTermination(); + if (upgPath) + execl(upgPath,upgPath,"-s",(char *)0); // -s = (re)start after install/upgrade + exitCode = -1; + fprintf(stderr,"%s: abnormal termination: unable to execute update at %s",argv[0],(upgPath) ? upgPath : "(unknown path)"); +#endif + } break; + case Node::NODE_UNRECOVERABLE_ERROR: { exitCode = -1; - termReason = node->reasonForTermination(); + const char *termReason = node->reasonForTermination(); fprintf(stderr,"%s: abnormal termination: %s\n",argv[0],(termReason) ? termReason : "(unknown reason)"); - break; + } break; default: break; } -- cgit v1.2.3