Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-22943

QProcess seems not to use QProcessEnvironment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.8.0, 4.8.x
    • Core: Other
    • None
    • * Windows 7 Ultimate 64 bit
      * Visual C++ Compiler 2010 (32 bit)
      * Qt 4.8.0 RC

      I am using the following code, which opens me a command prompt.

      QProcess process(this);
      QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
      env.insert("MYTEST", "Hello"); // Add an environment variable
      process.setProcessEnvironment(env);
      process.startDetached("cmd.exe");
      

      Now i am typing into this command prompt "echo %MYTEST%" and get the output "%MYTEST%", but expected output would be "Hello".

      The problem is that startDetached(...) is static function and therefore it can't know about my Environment.
      It would be great if there would be one more startDetached(...) function overload, which will take also a QProcessEnvironment as an function parameter.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            walteste Stefan Walter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes