Re: Reload/restart php-gtk program

From: Date: Wed, 08 Aug 2007 12:43:50 +0000
Subject: Re: Reload/restart php-gtk program
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-8033@lists.php.net to get a copy of this message
the interesting part is method lib/FreeTunesGui.php
        # just after update, reload a new process (just like shell
exec) ; current process give up, a new one is created
        protected function reload(){
                $this->main_quit();
                $cmd = DIR . '/easy-tunes';
                $args = array();
                pcntl_exec($cmd ,$args, $_ENV);
        }
here, we restart a new process (with GUI) ; this is the shell equivalent of : exec $cmd
Except for the fact that this requires pcntl which is not available on windows (and never will be) which kills the "cross platform" magic You can do the same thing by using popen followed immediately by pclose (spawns the process just as well) and die and add a lock check when writing files to make sure the original process has shut down.

« previous php.gtk.general (#8033) next »