sysrun.cc (498B)
1 #include "sys" 2 #include "config/config" 3 4 int sysrun(string const &s) { 5 int ret = system(s.c_str()); 6 if (ret == -1) { 7 warnmsg("Failed to start command: " << s << '\n'); 8 return -1; 9 } 10 if (WIFEXITED(ret)) { 11 int stat = WEXITSTATUS(ret); 12 if (stat) { 13 warnmsg("Command" << s << " exited with status " << stat << '\n'); 14 } else { 15 msg("Command " << s << " terminated normally\n"); 16 } 17 return stat; 18 } 19 warnmsg("Command " << s << " failed miserably!\n"); 20 return ret; 21 }