Changeset 217 for trunk/src/corelib


Ignore:
Timestamp:
Oct 9, 2009, 11:24:19 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: QProcess: Implemented workarounds for starting applications of different types (#72) and for startDetached() (#71).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qprocess_os2.cpp

    r216 r217  
    107107QT_BEGIN_NAMESPACE
    108108
     109
     110
    109111enum
    110112{
     
    744746                           const QStringList *environment, bool detached = false)
    745747{
    746     // @todo P_DETACH isn't supported by kLIBC atm, do something else
    747748    int mode = detached ? P_DETACH : P_NOWAIT;
    748749
    749     // Create argument list with right number of elements, and set the final
    750     // one to 0.
    751     char **argv = new char *[arguments.count() + 2];
     750    // Create argument list with right number of elements (one extra is for
     751    // the program name and one for the terminating 0). We also reserve 3
     752    // elements in front of the array for a posssible command processor call
     753    // insertion.
     754    char **argvBase = new char *[arguments.count() + 2 + 3];
     755
     756    // Don't use leading elements by default
     757    char **argv = argvBase + 3;
     758    // Set the final argument to 0
    752759    argv[arguments.count() + 1] = 0;
    753760
     
    902909        }
    903910
     911
     912
     913
     914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
     927
     928
     929
     930
     931
     932
     933
     934
     935
     936
     937
     938
     939
     940
     941
     942
     943
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
     954
     955
     956
     957
     958
     959
     960
     961
     962
    904963        // finally, start the thing
    905         pid = spawnve(mode, fullProgramName, argv, envv);
     964        pid = spawnve(mode, programReal, argvReal, envv);
     965
     966#if defined(QPROCESS_DEBUG)
     967        qDebug("qt_startProcess: pid %d", pid);
     968#endif
    906969
    907970        if (prependedLibPath) {
     
    914977    for (int i = 1 /* 0 is programName */; i <= arguments.count(); ++i)
    915978        delete [] argv[i];
    916     delete [] argv;
     979    delete [] argv;
    917980    if (envv != environ) {
    918981        for (int i = 0; i < envc; ++i)
Note: See TracChangeset for help on using the changeset viewer.