mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +00:00
Fix race condition, which could lock PC after running a build task.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@31707 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
84dc841e64
commit
615124400c
2 changed files with 24 additions and 23 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2010-12-04 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Framework/PCProjectBuilder.m (-build:, -logStdOut:, -logErrOut:):
|
||||||
|
Fix race condition, which could lock PC after running a build
|
||||||
|
task.
|
||||||
|
|
||||||
2010-12-04 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2010-12-04 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Framework/PCProjectManager.m (-newProject):
|
* Framework/PCProjectManager.m (-newProject):
|
||||||
|
|
|
@ -561,25 +561,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepearing to building
|
// Prepearing to building
|
||||||
_isLogging = YES;
|
|
||||||
stdOutPipe = [[NSPipe alloc] init];
|
stdOutPipe = [[NSPipe alloc] init];
|
||||||
stdOutHandle = [stdOutPipe fileHandleForReading];
|
stdOutHandle = [stdOutPipe fileHandleForReading];
|
||||||
[stdOutHandle waitForDataInBackgroundAndNotify];
|
|
||||||
|
|
||||||
[NOTIFICATION_CENTER addObserver:self
|
|
||||||
selector:@selector(logStdOut:)
|
|
||||||
name:NSFileHandleDataAvailableNotification
|
|
||||||
object:stdOutHandle];
|
|
||||||
|
|
||||||
_isErrorLogging = YES;
|
|
||||||
stdErrorPipe = [[NSPipe alloc] init];
|
stdErrorPipe = [[NSPipe alloc] init];
|
||||||
stdErrorHandle = [stdErrorPipe fileHandleForReading];
|
stdErrorHandle = [stdErrorPipe fileHandleForReading];
|
||||||
[stdErrorHandle waitForDataInBackgroundAndNotify];
|
|
||||||
|
|
||||||
[NOTIFICATION_CENTER addObserver:self
|
|
||||||
selector:@selector(logErrOut:)
|
|
||||||
name:NSFileHandleDataAvailableNotification
|
|
||||||
object:stdErrorHandle];
|
|
||||||
|
|
||||||
[errorsCountField setStringValue:[NSString stringWithString:@""]];
|
[errorsCountField setStringValue:[NSString stringWithString:@""]];
|
||||||
errorsCount = 0;
|
errorsCount = 0;
|
||||||
|
@ -612,6 +598,21 @@
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
[makeTask launch];
|
[makeTask launch];
|
||||||
|
|
||||||
|
// now that we know that the task is running start logging
|
||||||
|
[stdOutHandle waitForDataInBackgroundAndNotify];
|
||||||
|
[NOTIFICATION_CENTER addObserver:self
|
||||||
|
selector:@selector(logStdOut:)
|
||||||
|
name:NSFileHandleDataAvailableNotification
|
||||||
|
object:stdOutHandle];
|
||||||
|
_isLogging = YES;
|
||||||
|
|
||||||
|
[stdErrorHandle waitForDataInBackgroundAndNotify];
|
||||||
|
[NOTIFICATION_CENTER addObserver:self
|
||||||
|
selector:@selector(logErrOut:)
|
||||||
|
name:NSFileHandleDataAvailableNotification
|
||||||
|
object:stdErrorHandle];
|
||||||
|
_isErrorLogging = YES;
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
|
@ -620,7 +621,7 @@
|
||||||
@"OK", nil, nil, nil);
|
@"OK", nil, nil, nil);
|
||||||
|
|
||||||
//Clean up after task is terminated
|
//Clean up after task is terminated
|
||||||
[[NSNotificationCenter defaultCenter]
|
[NOTIFICATION_CENTER
|
||||||
postNotificationName:NSTaskDidTerminateNotification
|
postNotificationName:NSTaskDidTerminateNotification
|
||||||
object:makeTask];
|
object:makeTask];
|
||||||
}
|
}
|
||||||
|
@ -766,14 +767,11 @@
|
||||||
if ((data = [stdOutHandle availableData]) && [data length] > 0)
|
if ((data = [stdOutHandle availableData]) && [data length] > 0)
|
||||||
{
|
{
|
||||||
[self logData:data error:NO];
|
[self logData:data error:NO];
|
||||||
}
|
|
||||||
|
|
||||||
if (makeTask)
|
|
||||||
{
|
|
||||||
[stdOutHandle waitForDataInBackgroundAndNotify];
|
[stdOutHandle waitForDataInBackgroundAndNotify];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// stop logging after the task has closed the pipe
|
||||||
[NOTIFICATION_CENTER removeObserver:self
|
[NOTIFICATION_CENTER removeObserver:self
|
||||||
name:NSFileHandleDataAvailableNotification
|
name:NSFileHandleDataAvailableNotification
|
||||||
object:stdOutHandle];
|
object:stdOutHandle];
|
||||||
|
@ -788,14 +786,11 @@
|
||||||
if ((data = [stdErrorHandle availableData]) && [data length] > 0)
|
if ((data = [stdErrorHandle availableData]) && [data length] > 0)
|
||||||
{
|
{
|
||||||
[self logData:data error:YES];
|
[self logData:data error:YES];
|
||||||
}
|
|
||||||
|
|
||||||
if (makeTask)
|
|
||||||
{
|
|
||||||
[stdErrorHandle waitForDataInBackgroundAndNotify];
|
[stdErrorHandle waitForDataInBackgroundAndNotify];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// stop logging after the task has closed the pipe
|
||||||
[NOTIFICATION_CENTER removeObserver:self
|
[NOTIFICATION_CENTER removeObserver:self
|
||||||
name:NSFileHandleDataAvailableNotification
|
name:NSFileHandleDataAvailableNotification
|
||||||
object:stdErrorHandle];
|
object:stdErrorHandle];
|
||||||
|
|
Loading…
Reference in a new issue