Results 1 to 2 of 2

Thread: fork/exec equivalent in Qt, let the child continue to run

  1. #1
    Join Date
    Feb 2011
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default fork/exec equivalent in Qt, let the child continue to run

    Hi folks,

    I'm looking for a solution to the following problem:
    My application downloaded an update for itself, say MyApp_updated.exe. I then want to spawn a child process that closes my MyApp.exe, renames MyApp.exe to MyApp_old.exe, renames MyApp_updated.exe to MyApp.exe and then launches then new MyApp.exe.

    On Linux, I would use a combination of fork/execlp and perhaps a shell script.

    What would be the Qt-way of doing this, especially so that it works also on Windows?
    Especially, how is the child process continue to run after the parent is closed (parent must be closed, otherwise I couldn't move/rename the exe file).

    Regards,
    Philipp

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: fork/exec equivalent in Qt, let the child continue to run

    Use QProcess, for instance QProcess::startDetached.

Similar Threads

  1. 'Continue' in games help!
    By bmn in forum Newbie
    Replies: 3
    Last Post: 17th August 2011, 22:55
  2. why debug console continue appear?
    By banlinhtienphong in forum Qt Programming
    Replies: 4
    Last Post: 27th April 2011, 13:03
  3. gui and fork()
    By msh in forum Newbie
    Replies: 3
    Last Post: 7th January 2008, 23:08
  4. Detaching after fork from child process
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 15th November 2007, 09:56
  5. how to create resource fork & data fork
    By jyoti in forum General Discussion
    Replies: 4
    Last Post: 28th November 2006, 17:20

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.