summaryrefslogtreecommitdiffstats
path: root/process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'process.cpp')
-rw-r--r--process.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/process.cpp b/process.cpp
index d3d8fdb..2ee9246 100644
--- a/process.cpp
+++ b/process.cpp
@@ -144,12 +144,8 @@ void Process::forwardProcessOutput(qintptr fd, const QByteArray &data)
size -= written;
constData += written;
}
-
- if (mConfig.flags.testFlag(Config::PrintDebugMessages))
- qDebug() << data;
}
-
void Process::readyReadStandardOutput()
{
forwardProcessOutput(mStdoutFd, mProcess->readAllStandardOutput());
@@ -214,11 +210,7 @@ void Process::finished(int exitCode, QProcess::ExitStatus exitStatus)
void Process::startup()
{
-#ifdef Q_OS_ANDROID
- QProcessEnvironment pe = interactiveProcessEnvironment();
-#else
QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();
-#endif
QStringList args = mStartupArguments;
mBeingRestarted = false;
@@ -341,69 +333,3 @@ void Process::setStdoutFd(qintptr stdoutFd)
{
mStdoutFd = stdoutFd;
}
-
-QProcessEnvironment Process::interactiveProcessEnvironment() const
-{
- QProcessEnvironment env;
-
- QProcess process;
- process.start("sh");
- if (!process.waitForStarted(3000)) {
- printf("Could not start shell.\n");
- return env;
- }
-
- process.write("source /system/etc/mkshrc\n");
- process.write("export -p\n");
- process.closeWriteChannel();
-
- printf("waiting for process to finish\n");
- if (!process.waitForFinished(1000)) {
- printf("did not finish: terminate\n");
- process.terminate();
- if (!process.waitForFinished(1000)) {
- printf("did not terminate: kill\n");
- process.kill();
- if (!process.waitForFinished(1000)) {
- printf("Could not stop process.\n");
- }
- }
- }
-
- QList<QByteArray> list = process.readAllStandardOutput().split('\n');
- if (list.isEmpty())
- printf("Failed to read environment output\n");
-
- foreach (QByteArray entry, list) {
- if (entry.startsWith("export ")) {
- entry = entry.mid(7);
- } else if (entry.startsWith("declare -x ")) {
- entry = entry.mid(11);
- } else {
- continue;
- }
-
- QByteArray key;
- QByteArray value;
- int index = entry.indexOf('=');
-
- if (index > 0) {
- key = entry.left(index);
- value = entry.mid(index + 1);
- } else {
- key = entry;
- // value is empty
- }
-
- // Remove simple escaping.
- // This is not complete.
- if (value.startsWith('\'') and value.endsWith('\''))
- value = value.mid(1, value.size()-2);
- else if (value.startsWith('"') and value.endsWith('"'))
- value = value.mid(1, value.size()-2);
-
- env.insert(key, value);
- }
-
- return env;
-}