Improve reliability

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32316 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-02-23 08:56:25 +00:00
parent 345a7ae0d7
commit 2aed57d95a
2 changed files with 36 additions and 3 deletions

View file

@ -2,6 +2,8 @@
* Source/GSString.m: Fix bugs in upper and lower casing of constant
strings.
* Source/NSTask.m: Force check of termination status when we call
-isRunning.
2011-02-22 Nicola Pero <nicola.pero@meta-innovation.com>

View file

@ -939,7 +939,7 @@ GSPrivateCheckTasks()
{
BOOL found = NO;
if (hadChildSignal == YES)
if (YES == hadChildSignal)
{
NSArray *a;
unsigned c;
@ -1351,7 +1351,7 @@ GSPrivateCheckTasks()
{
BOOL found = NO;
if (hadChildSignal == YES)
if (YES == hadChildSignal)
{
int result;
int status;
@ -1682,7 +1682,38 @@ GSPrivateCheckTasks()
- (void) _collectChild
{
GSPrivateCheckTasks();
if (_hasCollected == NO)
{
int result;
int status;
errno = 0;
result = waitpid(_taskId, &status, WNOHANG);
if (result > 0)
{
if (WIFEXITED(status))
{
#if defined(WAITDEBUG)
NSLog(@"waitpid %d, exit status = %d",
result, status);
#endif
[self _terminatedChild: WEXITSTATUS(status)];
}
else if (WIFSIGNALED(status))
{
#if defined(WAITDEBUG)
NSLog(@"waitpid %d, termination status = %d",
result, status);
#endif
[self _terminatedChild: WTERMSIG(status)];
}
else
{
NSLog(@"Warning ... task %d neither exited nor signalled",
result);
}
}
}
}
- (BOOL) usePseudoTerminal