Relative paths do work. You have to use apr_procattr_dir_set. It is relative
to the calling process cwd.
I need to set cwd directory to be the directory location of the calling
process.
e.g.
If the parent process is /openload/bin/openload.exe.
I need to set the directory location to "/openload/bin".
In the apr how do you get the directory of the main process?
status = apr_procattr_dir_set(attr,directory_location);
Steve
----- Original Message -----
From: "Stephen Ince" <[email protected]>
To: "Eric Covener" <[email protected]>; "APR Development"
<[email protected]>
Sent: Friday, March 13, 2009 9:59 AM
Subject: Re: exec a process.
I just one final issue. I can't seem to get relative paths to work for
apr_proc_create. Absolute path works great.
I have also tried using apr_filepath_root to get the canonical but I can't
seem to get it work either.
I have tried the following.
exec_name="openload.exe";
// this fails. openload.exe is actually the program itself (it is in
the same directory). (/openload/bin/openload.exe works )
exec_path="./openload.exe";
args[0] = exec_name;
args[1] = url->arg;
args[2] = NULL;
status = apr_proc_create(&newproc, exec_path, args, NULL, attr, pool);
Is there a way for "apr_proc_create" to use relative paths for an
executeable or get the canonical path for an executeable?
I am testing on win32. Any help would be greatly appreciated.
Steve
----- Original Message -----
From: "Eric Covener" <[email protected]>
To: "APR Development" <[email protected]>
Sent: Wednesday, March 11, 2009 12:16 PM
Subject: Re: exec a process.
On Wed, Mar 11, 2009 at 12:08 PM, Stephen Ince <[email protected]>
wrote:
Is there a portable way to exec a file within the apr?
I noticed that apr_proc_fork is not portable.
I basically want to do the following.
#setup stdin and stdout.
exec("/my file") in a separate process.
#wait for the process.
apr_procattr_* is available:
http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_thread_proc.h?view=co
http://svn.apache.org/viewvc/apr/apr/trunk/test/testproc.c?view=co
--
Eric Covener
[email protected]