summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dialog.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index bdeab16..94b271c 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -170,31 +170,27 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index)
UserConfig::setNewsHelpOpen(!ui->helpBox->isHidden());
UserConfig::sync();
- QProcess *process = nullptr;
+ qint64 scriptPid = 0;
if (QFile::exists(SESSION_START_SCRIPT)) {
// Companion script
- process = new QProcess;
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- env.insert("SESSION_NAME", s->shortDescription());
- env.insert("SESSION_UUID", s->uuid());
- env.insert("SESSION_CMD", s->execCommand());
+ setenv("SESSION_NAME", s->shortDescription().toLocal8Bit().constData(), 1);
+ setenv("SESSION_UUID", s->uuid().toLocal8Bit().constData(), 1);
+ setenv("SESSION_CMD", s->execCommand().toLocal8Bit().constData(), 1);
if (s->type() == Session::VSESSION) {
- env.insert("SESSION_TYPE", "VSESSION");
+ setenv("SESSION_TYPE", "VSESSION", 1);
} else if (s->type() == Session::XSESSION) {
- env.insert("SESSION_TYPE", "XSESSION");
+ setenv("SESSION_TYPE", "XSESSION", 1);
+ }
+ if (!QProcess::startDetached(SESSION_START_SCRIPT, QStringList(), QStringLiteral("/"), &scriptPid)) {
+ scriptPid = 0;
}
- process->setProcessEnvironment(env);
- process->start(SESSION_START_SCRIPT);
- process->closeReadChannel(QProcess::StandardError);
- process->closeReadChannel(QProcess::StandardOutput);
- process->closeWriteChannel();
}
// Run session
s->run();
// Should not return on success
- if (process != nullptr) {
- process->terminate();
+ if (scriptPid > 0) {
+ ::kill(pid_t(scriptPid), SIGTERM);
}
QMessageBox::critical(
this, trUtf8("vmchooser"),