summaryrefslogtreecommitdiffstats
path: root/src/pvs.cpp
diff options
context:
space:
mode:
authorFabian Schillinger2010-11-05 02:03:45 +0100
committerFabian Schillinger2010-11-05 02:03:45 +0100
commit98d31dde1d8c220bd3602d4751c24508a54e3fab (patch)
tree3921ed97778912a00263728dab105f35f6d1f8e6 /src/pvs.cpp
parent[PVSMGRTOUCH] resetall bug fixed (diff)
downloadpvs-98d31dde1d8c220bd3602d4751c24508a54e3fab.tar.gz
pvs-98d31dde1d8c220bd3602d4751c24508a54e3fab.tar.xz
pvs-98d31dde1d8c220bd3602d4751c24508a54e3fab.zip
Process start/stop/view functionality
Cleanup write to logfiles if start/stop/view of processes failed added some prompts stop more then one process at the same time
Diffstat (limited to 'src/pvs.cpp')
-rwxr-xr-xsrc/pvs.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/pvs.cpp b/src/pvs.cpp
index bda16f8..5469eaa 100755
--- a/src/pvs.cpp
+++ b/src/pvs.cpp
@@ -265,15 +265,18 @@ void PVS::onCommand(PVSMsg cmdMessage)
}
if (ident.compare("STARTPROCESS") == 0)
{
+ processName = message;
QProcess *proc = new QProcess( this );
proc->start(message); //we try to run the process with the name message
- _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "START Process "+message+": started"));
+ connect( proc, SIGNAL( error(QProcess::ProcessError)), this, SLOT( processStartErrorOccured(QProcess::ProcessError)));
return;
}
if (ident.compare("KILLPROCESS") == 0)
{
+ processName = message;
QProcess *proc = new QProcess( this );
proc->start("kill "+message); //we try to kill the process with the given ID
+ connect( proc, SIGNAL( error(QProcess::ProcessError)), this, SLOT( processStopErrorOccured(QProcess::ProcessError)));
return;
}
@@ -929,14 +932,18 @@ void PVS::showProc()
{
//look at procfs
QDir procfs("/proc");
- QStringList proc = procfs.entryList();
+ QStringList procList = procfs.entryList();
int uid = getuid();
bool write;
-
- for (int i=0;i<proc.length();i++) //every directory in /proc is checked
+ if (procList.length() < 1)
+ {
+ _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "SHOW ERROR"));
+ return;
+ }
+ for (int i=0;i<procList.length();i++) //every directory in /proc is checked
{
write = false;
- QString tmp = proc.at(i);
+ QString tmp = procList.at(i);
QString snd = "";
if (!tmp.contains(QRegExp("\\D"))) //we have to check if name is number
{
@@ -992,3 +999,16 @@ void PVS::showProc()
}
_pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "SHOW finished")); //at the end we send that every process has been sent
}
+
+//tell connectionManager that error occured
+void PVS::processStartErrorOccured(QProcess::ProcessError error)
+{
+ _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "START ERROR "+QString::number(error)+" "+processName));
+ processName = "";
+}
+
+void PVS::processStopErrorOccured(QProcess::ProcessError error)
+{
+ _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "STOP ERROR "+QString::number(error)+" "+processName));
+ processName = "";
+}