В 12:39 -0500 на 02.02.2010 (вт), Ian D. Leroux написа:
> To check that I'm doing this right, here are the relevant lines I see
> in
> $ ps ax
> in each of the two cases
>
> 28485 ? S< 0:00 /usr/bin/gdnc --daemon
>
> 28729 pts/2 S< 0:00 /usr/bin/gdnc --daemon
Just to be sure, could you run a crashing app in gdb, and when it stops
on SIGABRT, check how many gdnc instances are running?
> I await the test program with interest.
Let's try something very simple first. Install libgnustep-base-dev and
compile he attached program with "gs_make". Then run ./obj/nctest.
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = nctest
nctest_OBJC_FILES = nctest.m
include $(GNUSTEP_MAKEFILES)/tool.make
#import <Foundation/Foundation.h>
int
main (int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSProcessInfo *proc = [NSProcessInfo processInfo];
NSBundle *bundle = [NSBundle mainBundle];
NSArray *args;
unsigned i;
int retval = 0;
[NSProcessInfo initializeWithArguments:argv
count:argc
environment:env];
args = [proc arguments];
GSPrintf (stderr, @"Useless info about bundle: %...@\n", bundle);
if ([args count] <= 1)
{
GSPrintf (stderr, @"Please specify some arguments.\n");
RELEASE (pool);
exit (EXIT_FAILURE);
}
else if ([[proc environment] valueForKey:@"NOHANDLE"] != nil)
GSPrintf (stderr, @"NOHANDLE defined; should exit with success.\n");
else
{
for (i = 1; i < [args count]; i++)
{
NSString *opt = [args objectAtIndex: i];
NS_DURING
{
NSString *tempString;
id result;
tempString = [NSString stringWithString: opt];
if (tempString == nil)
GSPrintf (stderr, @"This should not happen.\n");
/* Exception handler taking care here. */
else if (![tempString propertyList]);
else if ((result = [tempString propertyList]) == nil)
GSPrintf (stderr, @"'%@' - a nil property list.\n", opt);
else if ([result isKindOfClass: [NSDictionary class]] == YES)
GSPrintf (stderr, @"'%@' - a dictionary.\n", opt);
else if ([result isKindOfClass: [NSArray class]] == YES)
GSPrintf (stderr, @"'%@' - an array.\n", opt);
else if ([result isKindOfClass: [NSString class]] == YES)
GSPrintf (stderr, @"'%@' - a string.\n", opt);
else
GSPrintf (stderr, @"'%@' - unknown class %...@.\n",
opt, [[result class] description]);
}
NS_HANDLER
{
GSPrintf (stderr, @"'%@' failed with:\...@.\n", opt,
[localException reason]);
GSPrintf (stderr, @"Failure.\n");
retval = 1;
}
NS_ENDHANDLER
}
}
RELEASE (pool);
return retval;
}