Results 1 to 2 of 2

Thread: QProcess::startDetached on windows, some processes exit immediately

  1. #1
    Join Date
    Apr 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess::startDetached on windows, some processes exit immediately

    I have server what starts clients using the QProcess::startDetached. Those clients connect to the server using TCP and stay working (processing data from the server) as long the server runs; they terminate when the socket connection is lost.

    But... there is a problem with startDetached I could not solve so far. It works fine for ".exe" files compiled in Visual Studio. However, I have some clients written in php. The php files just blink in a window and those are gone. Log clearly shows that those are started but somehow they vanish to void. If I start those scripts manually from a cmd.exe "shell" then those all work just fine.

    I tried:
    QProcess::startDetached("php xyz.php -param1 1 -param2 2");
    QProcess::startDetached("C:\Program Files (x86)\PHP\php.exe xyz.php -param1 1 -param2 2");
    QProcess::startDetached("cmd /C C:\Program Files (x86)\PHP\php.exe xyz.php -param1 1 -param2 2");
    QProcess::startDetached("cmd /C \"C:\Program Files (x86)\PHP\php.exe xyz.php -param1 1 -param2 2\"");

    In both four cases, startDetached returns true and I see a blink so a window is created for the php script but it disappears to quick to read. Hmm, any idea? Again, those scripts run fine if started from an already existing cmd.exe so there is some trick there; what might that be?

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QProcess::startDetached on windows, some processes exit immediately

    errr, so if you want the shell to stay open, why use /C ???
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. QProcess::startDetached and UAC on Vista
    By serious_jack in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2011, 06:13
  2. Replies: 1
    Last Post: 18th May 2011, 17:18
  3. Replies: 0
    Last Post: 24th November 2010, 11:11
  4. QProcess::startDetached fails on Mac
    By sgmurphy19 in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2008, 09:26
  5. QProcess-startDetached and Console screen problem
    By ramazangirgin in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2008, 08:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.