Re: basic popen / pclose issue
Re: basic popen / pclose issue
- Subject: Re: basic popen / pclose issue
- From: Kevin Elliott <email@hidden>
- Date: Fri, 17 Nov 2006 10:55:39 -0800
If you look at the popen man page you'll see the following line:
The pclose() function waits for the associated process to terminate and
returns the exit status of the command as returned by wait4(2).
As long as your launched process is running, pclose will not return.
Please consider moving away from popen. It has very well documented
security problems. Depending on what your comfortable with a number
of other API's are avaiable from fork/exec at the Unix end to NSTask
in Cocoa. All of them are much better choices that popen.
At 8:40 AM -0800 on 11/17/06, David Alter wrote:
I think I should start out by saying I do not do a lot of Unix programming.
I have a FileMaker plugin that starts a separate process. It allows
the separate process to be running after you quit FileMaker. I did
this using popen. This was done for an old style FileMaker plugin
that was built as a CFM. So I had to have some bridge code for it to
make the popen and pclose calls. The call I make to popen is a shell
script that sets up some environment variables and starts a
background server.
Now I'm rewriting the plugin for the new APIs. With the new API I
can build as Moch-O and make POSIX calls. I'm having trouble with
popen working. Maybe it is pclose that is the problem. It is very
basic code I can't imagine what the issue is. Here is the code
FILE *fp = nil;
fp = popen( path.c_str(), "r" );
if ( fp != NULL ) {
pclose(fp);
}
The file opens successfully and launches my process. But It will not
let me close the pipe. I do not need to read anything off the pipe.
If I leave the pipe open it does not let me close the last open
database in FileMaker.
Does anyone have any suggestions.
thanks for the help.
-dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
______________________________________________________
Arguing with an engineer is like wrestling with a pig in mud.
After a while, you realize the pig is enjoying it.
______________________________________________________
Kevin Elliott <mailto:email@hidden>
AIM/iChatAV: email@hidden (video chat available)
______________________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden