@@ -144,12 +144,8 @@ void Process::forwardProcessOutput(qintptr fd, const QByteArray &data)
144
144
size -= written;
145
145
constData += written;
146
146
}
147
-
148
- if (mConfig .flags .testFlag (Config::PrintDebugMessages))
149
- qDebug () << data;
150
147
}
151
148
152
-
153
149
void Process::readyReadStandardOutput ()
154
150
{
155
151
forwardProcessOutput (mStdoutFd , mProcess ->readAllStandardOutput ());
@@ -214,11 +210,7 @@ void Process::finished(int exitCode, QProcess::ExitStatus exitStatus)
214
210
215
211
void Process::startup ()
216
212
{
217
- #ifdef Q_OS_ANDROID
218
- QProcessEnvironment pe = interactiveProcessEnvironment ();
219
- #else
220
213
QProcessEnvironment pe = QProcessEnvironment::systemEnvironment ();
221
- #endif
222
214
QStringList args = mStartupArguments ;
223
215
mBeingRestarted = false ;
224
216
@@ -341,69 +333,3 @@ void Process::setStdoutFd(qintptr stdoutFd)
341
333
{
342
334
mStdoutFd = stdoutFd;
343
335
}
344
-
345
- QProcessEnvironment Process::interactiveProcessEnvironment () const
346
- {
347
- QProcessEnvironment env;
348
-
349
- QProcess process;
350
- process.start (" sh" );
351
- if (!process.waitForStarted (3000 )) {
352
- printf (" Could not start shell.\n " );
353
- return env;
354
- }
355
-
356
- process.write (" source /system/etc/mkshrc\n " );
357
- process.write (" export -p\n " );
358
- process.closeWriteChannel ();
359
-
360
- printf (" waiting for process to finish\n " );
361
- if (!process.waitForFinished (1000 )) {
362
- printf (" did not finish: terminate\n " );
363
- process.terminate ();
364
- if (!process.waitForFinished (1000 )) {
365
- printf (" did not terminate: kill\n " );
366
- process.kill ();
367
- if (!process.waitForFinished (1000 )) {
368
- printf (" Could not stop process.\n " );
369
- }
370
- }
371
- }
372
-
373
- QList<QByteArray> list = process.readAllStandardOutput ().split (' \n ' );
374
- if (list.isEmpty ())
375
- printf (" Failed to read environment output\n " );
376
-
377
- foreach (QByteArray entry, list) {
378
- if (entry.startsWith (" export " )) {
379
- entry = entry.mid (7 );
380
- } else if (entry.startsWith (" declare -x " )) {
381
- entry = entry.mid (11 );
382
- } else {
383
- continue ;
384
- }
385
-
386
- QByteArray key;
387
- QByteArray value;
388
- int index = entry.indexOf (' =' );
389
-
390
- if (index > 0 ) {
391
- key = entry.left (index );
392
- value = entry.mid (index + 1 );
393
- } else {
394
- key = entry;
395
- // value is empty
396
- }
397
-
398
- // Remove simple escaping.
399
- // This is not complete.
400
- if (value.startsWith (' \' ' ) and value.endsWith (' \' ' ))
401
- value = value.mid (1 , value.size ()-2 );
402
- else if (value.startsWith (' "' ) and value.endsWith (' "' ))
403
- value = value.mid (1 , value.size ()-2 );
404
-
405
- env.insert (key, value);
406
- }
407
-
408
- return env;
409
- }
0 commit comments