Re: popen() and virtual dir
| From: | Shane Caraveo | Date: | Sat, 10 Jun 2000 18:34:49 +0000 |
| Subject: | Re: popen() and virtual dir | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-20963@lists.php.net to get a copy of this message | ||
Under windows, we probably have to switch to win32 functions, rather
than c library functions. With the win32 functions, you can define a
'working' directory which is where the program gets executed from. So
if the program you want to execute is 'dir.exe', then you would prepend
the virtual dir ('virtualdir\dir.exe') and also pass a 'parameter'
(actually an item in a structure I think) that contains the working
directory, which would simply be the virtualdir.
Andi Gutmans wrote:
>
> At 11:08 AM 6/10/00 -0700, Rasmus Lerdorf wrote:
> > > What do you guys want to do with popen() and virtual_dir? This effects all
> > > of the exec() functions.
> > > We can either do a real chdir() before calling it and mutexing the whole
> > > section; or we can take a more complicated approach of creating a new
> > > process and doing the chdir() there. Last but not least, we could just
> > > disable these functions :)
> >
> >Well, disabling them is not really an option. As for creating a new
> >process and doing a chdir() there. These functions already create a new
> >process. Would something like:
> >
> > popen("cd /path; cmd")
> >
> >do the trick? ie. prepend the virtual_dir chdir to the cmd string we pass
> >to these functions. The chdir should be isolated to the spawned process.
>
> That sounds like a good idea! It might actually work. The question is, how
> do you do it on Windows? And do all major UNIX shells support the command1;
> command2 syntax? bash, tcsh and sh do, but I don't know about shells such
> as ksh and so on. Is this maybe in a standard?
>
> Andi
> ---
> Andi Gutmans <andi@zend.com>
> http://www.zend.com/
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net