#include <sys/wait.h>
#include <csignal>
#include <cstdlib>
-#include <cstdio>
#include <unistd.h>
#include "debug.h"
#include "syscall.h"
#include "syscontr.h"
#include "support/lstrings.h"
+#include "support/lyxlib.h"
+
+using std::endl;
+
Systemcalls::Systemcalls() {
pid = 0; // No child yet
#if 0
// If the child is alive, we have to brutally kill it
if (getpid() != 0) {
- ::kill(getpid(), SIGKILL);
+ lyx::kill(getpid(), SIGKILL);
}
#endif
}
return retval;
}
-void Systemcalls::kill(int tolerance) {
+void Systemcalls::kill(int /*tolerance*/) {
if (getpid() == 0) {
lyxerr << "LyX: Can't kill non-existing process." << endl;
return;
}
- int ret = ::kill(getpid(), SIGHUP);
+ int ret = lyx::kill(getpid(), SIGHUP);
bool wait_for_death = true;
if (ret != 0) {
if (errno == ESRCH) {
// Here, we should add the PID to a list of
// waiting processes to kill if they are not
// dead without tolerance seconds
-#ifdef WITH_WARNINGS
-#warning Implement this using the timer of the singleton systemcontroller (Asger)
-#endif
+
+ // CHECK Implement this using the timer of
+ // the singleton systemcontroller (Asger)
+
}
}
int index = 0;
bool more;
do {
+ childcommand = frontStrip(childcommand);
if (syscmd == 0) {
syscmd = new char[childcommand.length() + 1];
childcommand.copy(syscmd, childcommand.length());
syscmd[childcommand.length()] = '\0';
}
+ if (!childcommand.empty()) {
char * tmp = new char[childcommand.length() + 1];
childcommand.copy(tmp, childcommand.length());
tmp[childcommand.length()] = '\0';
argv[index++] = tmp;
+ }
+
// reinit
more = !rest.empty();
if (more)
}
-int main(int, char**)
+int main(int, char **)
{
SystemcallsSingletoncontroller::Startcontroller starter;