Re: Calling a Command line tool from an application
Re: Calling a Command line tool from an application
- Subject: Re: Calling a Command line tool from an application
- From: Justin Walker <email@hidden>
- Date: Tue, 12 Apr 2005 16:49:51 -0700
On Apr 12, 2005, at 16:37, Dave Rehring wrote:
On 4/12/05 3:40 PM, Kevin Harris at email@hidden wrote:
Tommy Nordgren wrote:
Apr 11, 2005 kl. 11:26 PM skrev Justin Walker:
On Apr 11, 2005, at 14:17, Rick Steele wrote:
Can anybody point me to docs which explain calling a command line
tool from an application an providing it argumetns?
[snip]
There are other issues to consider as well. Signal masks, file
descriptors (if the close-on-exec flag is not set), etc. will all be
inherited by the executed process. It may be necessary to reset the
signal masks and close those files in the child process after doing
the
initial fork. If the output of the program is required, a pipe will
need to be created to read(2) stdout from the child process. Things
become even more hairy if you want the parent process to terminate the
child after some maximum delay time.
In any case, the man pages for fork(2), pipe(2), close(2), dup2(2),
exec(3), and wait(2) should all come in handy. For twiddling the
close-on-exec behavior, the fcntl(2) man page (F_GETFD and F_SETFD)
will
also be useful. You can check
http://www.opengroup.org/onlinepubs/009695399/ for more information
about each of these system calls; there are some things documented
there
that you may not catch in the man pages.
Valid issues, all.
It will likely be MUCH easier to search for a library that handles all
of the gory details for you.
Modulo that procedure's coping with security issues.
Am I misunderstanding the problem, but the NSTask Objective-C class
seems
exactly on point. It should even be usable if the person is doing
development using Carbon... It should be WAY easier than any of the
other
methods described here.
The OP is using Carbon, and this might work (I know sufficiently little
about NSAnything that I have no clue :-})
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
Some people have a mental horizon of radius zero, and
call it their point of view.
-- David Hilbert
--------
_______________________________________________
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