diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ProcessManager.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ProcessManager.cpp b/src/ProcessManager.cpp index e34ebfc..09f725f 100644 --- a/src/ProcessManager.cpp +++ b/src/ProcessManager.cpp @@ -1,5 +1,7 @@ #include "ProcessManager.hpp" +#include <fcntl.h> #include <sys/ioctl.h> +#include <unistd.h> #include <QProcess> #include <QThread> @@ -28,8 +30,23 @@ ProcessManager::ProcessManager(const QString &newPrefix, const QString &newId, b stdErr.setFileName(prefix + id + "stderr"); ctrlIn.setFileName(prefix + id + "ctrlin"); ctrlOut.setFileName(prefix + id + "ctrlout"); + + bool reattach = ctrlIn.exists(); + if(reattach) + { + int fd = open(ctrlIn.fileName().toLocal8Bit().toStdString().c_str(), O_WRONLY | O_NONBLOCK); + if(fd == -1) + { + reattach = false; + } + else + { + close(fd); + } + } + bool reattaching = false; - if(!ctrlIn.exists()) + if(!reattach) { if(!QProcess::startDetached("ProcessManager", QStringList() << prefix + id)) { |
