Removed some verbosity from procs library.
This commit is contained in:
parent
ea71dd2d5c
commit
b907ade842
1 changed files with 10 additions and 7 deletions
|
@ -112,7 +112,7 @@ void Util::Procs::childsig_handler(int signum){
|
||||||
std::string pname = plist[ret];
|
std::string pname = plist[ret];
|
||||||
#endif
|
#endif
|
||||||
plist.erase(ret);
|
plist.erase(ret);
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 5
|
||||||
if (isActive(pname)){
|
if (isActive(pname)){
|
||||||
Stop(pname);
|
Stop(pname);
|
||||||
} else{
|
} else{
|
||||||
|
@ -124,7 +124,7 @@ void Util::Procs::childsig_handler(int signum){
|
||||||
if (exitHandlers.count(ret) > 0){
|
if (exitHandlers.count(ret) > 0){
|
||||||
TerminationNotifier tn = exitHandlers[ret];
|
TerminationNotifier tn = exitHandlers[ret];
|
||||||
exitHandlers.erase(ret);
|
exitHandlers.erase(ret);
|
||||||
#if DEBUG >= 2
|
#if DEBUG >= 5
|
||||||
std::cerr << "Calling termination handler for " << pname << std::endl;
|
std::cerr << "Calling termination handler for " << pname << std::endl;
|
||||||
#endif
|
#endif
|
||||||
tn(ret, exitcode);
|
tn(ret, exitcode);
|
||||||
|
@ -209,7 +209,7 @@ pid_t Util::Procs::Start(std::string name, std::string cmd){
|
||||||
runCmd(cmd);
|
runCmd(cmd);
|
||||||
}else{
|
}else{
|
||||||
if (ret > 0){
|
if (ret > 0){
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 5
|
||||||
std::cerr << "Process " << name << " started, PID " << ret << ": " << cmd << std::endl;
|
std::cerr << "Process " << name << " started, PID " << ret << ": " << cmd << std::endl;
|
||||||
#endif
|
#endif
|
||||||
plist.insert(std::pair<pid_t, std::string>(ret, name));
|
plist.insert(std::pair<pid_t, std::string>(ret, name));
|
||||||
|
@ -273,7 +273,7 @@ pid_t Util::Procs::Start(std::string name, std::string cmd, std::string cmd2){
|
||||||
runCmd(cmd2);
|
runCmd(cmd2);
|
||||||
}else{
|
}else{
|
||||||
if (ret2 > 0){
|
if (ret2 > 0){
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 5
|
||||||
std::cerr << "Process " << name << " started, PIDs (" << ret << ", " << ret2 << "): " << cmd << " | " << cmd2 << std::endl;
|
std::cerr << "Process " << name << " started, PIDs (" << ret << ", " << ret2 << "): " << cmd << " | " << cmd2 << std::endl;
|
||||||
#endif
|
#endif
|
||||||
plist.insert(std::pair<pid_t, std::string>(ret2, name));
|
plist.insert(std::pair<pid_t, std::string>(ret2, name));
|
||||||
|
@ -356,7 +356,7 @@ pid_t Util::Procs::Start(std::string name, std::string cmd, std::string cmd2, st
|
||||||
runCmd(cmd2);
|
runCmd(cmd2);
|
||||||
}else{
|
}else{
|
||||||
if (ret2 > 0){
|
if (ret2 > 0){
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 5
|
||||||
std::cerr << "Process " << name << " started, PIDs (" << ret << ", " << ret2 << "): " << cmd << " | " << cmd2 << std::endl;
|
std::cerr << "Process " << name << " started, PIDs (" << ret << ", " << ret2 << "): " << cmd << " | " << cmd2 << std::endl;
|
||||||
#endif
|
#endif
|
||||||
plist.insert(std::pair<pid_t, std::string>(ret2, name));
|
plist.insert(std::pair<pid_t, std::string>(ret2, name));
|
||||||
|
@ -387,7 +387,7 @@ pid_t Util::Procs::Start(std::string name, std::string cmd, std::string cmd2, st
|
||||||
runCmd(cmd3);
|
runCmd(cmd3);
|
||||||
}else{
|
}else{
|
||||||
if (ret3 > 0){
|
if (ret3 > 0){
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 5
|
||||||
std::cerr << "Process " << name << " started, PIDs (" << ret << ", " << ret2 << ", " << ret3 << "): " << cmd << " | " << cmd2 << " | " << cmd3 << std::endl;
|
std::cerr << "Process " << name << " started, PIDs (" << ret << ", " << ret2 << ", " << ret3 << "): " << cmd << " | " << cmd2 << " | " << cmd3 << std::endl;
|
||||||
#endif
|
#endif
|
||||||
plist.insert(std::pair<pid_t, std::string>(ret3, name));
|
plist.insert(std::pair<pid_t, std::string>(ret3, name));
|
||||||
|
@ -416,6 +416,9 @@ pid_t Util::Procs::Start(std::string name, std::string cmd, std::string cmd2, st
|
||||||
/// \arg fdout Same as fdin, but for stderr.
|
/// \arg fdout Same as fdin, but for stderr.
|
||||||
pid_t Util::Procs::StartPiped(std::string name, char * argv[], int * fdin, int * fdout, int * fderr){
|
pid_t Util::Procs::StartPiped(std::string name, char * argv[], int * fdin, int * fdout, int * fderr){
|
||||||
if (isActive(name)){
|
if (isActive(name)){
|
||||||
|
#if DEBUG >= 1
|
||||||
|
std::cerr << name << " already active - skipping start" << std::endl;
|
||||||
|
#endif
|
||||||
return getPid(name);
|
return getPid(name);
|
||||||
}
|
}
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
@ -534,7 +537,7 @@ pid_t Util::Procs::StartPiped(std::string name, char * argv[], int * fdin, int *
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}else{ //parent
|
}else{ //parent
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 5
|
||||||
std::cerr << "Piped process " << name << " started";
|
std::cerr << "Piped process " << name << " started";
|
||||||
if (fdin ) std::cerr << " in=" << (*fdin == -1 ? pipein [1] : *fdin );
|
if (fdin ) std::cerr << " in=" << (*fdin == -1 ? pipein [1] : *fdin );
|
||||||
if (fdout) std::cerr << " out=" << (*fdout == -1 ? pipeout[0] : *fdout);
|
if (fdout) std::cerr << " out=" << (*fdout == -1 ? pipeout[0] : *fdout);
|
||||||
|
|
Loading…
Add table
Reference in a new issue