Changeset View
Changeset View
Standalone View
Standalone View
ksgrd/SensorShellAgent.cpp
Show All 19 Lines | |||||
20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
21 | 21 | | |||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include <QDebug> | 24 | #include <QDebug> | ||
25 | #include <kprocess.h> | 25 | #include <kprocess.h> | ||
26 | #include <kshell.h> | 26 | #include <kshell.h> | ||
27 | #include <klocalizedstring.h> | 27 | #include <klocalizedstring.h> | ||
28 | #include <QStandardPaths> | ||||
28 | 29 | | |||
29 | #include "ksgrd_debug.h" | 30 | #include "ksgrd_debug.h" | ||
30 | #include "SensorManager.h" | 31 | #include "SensorManager.h" | ||
31 | 32 | | |||
32 | #include "SensorShellAgent.h" | 33 | #include "SensorShellAgent.h" | ||
33 | 34 | | |||
34 | using namespace KSGRD; | 35 | using namespace KSGRD; | ||
35 | 36 | | |||
Show All 27 Lines | 63 | connect( mDaemon, SIGNAL(error(QProcess::ProcessError)), | |||
63 | SLOT(daemonError(QProcess::ProcessError)) ); | 64 | SLOT(daemonError(QProcess::ProcessError)) ); | ||
64 | connect( mDaemon, SIGNAL(finished(int,QProcess::ExitStatus)), | 65 | connect( mDaemon, SIGNAL(finished(int,QProcess::ExitStatus)), | ||
65 | SLOT(daemonExited(int,QProcess::ExitStatus)) ); | 66 | SLOT(daemonExited(int,QProcess::ExitStatus)) ); | ||
66 | connect( mDaemon.data(), &QProcess::readyReadStandardOutput, | 67 | connect( mDaemon.data(), &QProcess::readyReadStandardOutput, | ||
67 | this, &SensorShellAgent::msgRcvd ); | 68 | this, &SensorShellAgent::msgRcvd ); | ||
68 | connect( mDaemon.data(), &QProcess::readyReadStandardError, | 69 | connect( mDaemon.data(), &QProcess::readyReadStandardError, | ||
69 | this, &SensorShellAgent::errMsgRcvd ); | 70 | this, &SensorShellAgent::errMsgRcvd ); | ||
70 | 71 | | |||
72 | if (!QStandardPaths::findExecutable("setsid").isEmpty()) | ||||
73 | *mDaemon << "setsid" << "-w" << "--"; | ||||
71 | if ( !command.isEmpty() ) { | 74 | if ( !command.isEmpty() ) { | ||
72 | *mDaemon << KShell::splitArgs(command); | 75 | *mDaemon << KShell::splitArgs(command); | ||
73 | } | 76 | } | ||
74 | else | 77 | else | ||
75 | *mDaemon << mShell << hostName() << QStringLiteral("ksysguardd"); | 78 | *mDaemon << mShell << hostName() << QStringLiteral("ksysguardd"); | ||
76 | mDaemon->start(); | 79 | mDaemon->start(); | ||
77 | 80 | | |||
78 | return true; | 81 | return true; | ||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |