Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

it should work all the time at launch when using the automatic option

  • Loading branch information...
commit a6a54b2e27bd1d728c3d676f7be8e28c707fbf4f 1 parent 052eac2
Jérôme Lebel authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 iProxyMacSetup/Classes/iProxyMacSetupAppDelegate.m
View
11 iProxyMacSetup/Classes/iProxyMacSetupAppDelegate.m
@@ -100,12 +100,12 @@ - (NSTask *)taskWithLaunchPath:(NSString *)launchPath arguments:(NSArray *)argum
NSTask *task;
NSPipe *outputPipe = [[NSPipe alloc] init];
- NSLog(@"%@ %@", launchPath, arguments);
- [[outputPipe fileHandleForReading] readToEndOfFileInBackgroundAndNotify];
task = [[NSTask alloc] init];
[task setLaunchPath:launchPath];
[task setArguments:arguments];
[task setStandardOutput:outputPipe];
+ [task setStandardInput:[NSFileHandle fileHandleWithNullDevice]];
+ [task setStandardError:[NSFileHandle fileHandleWithNullDevice]];
[outputPipe release];
return task;
}
@@ -115,6 +115,7 @@ - (void)fetchDeviceList
NSTask *task;
task = [self taskWithLaunchPath:NETWORKSETUP_PATH arguments:[NSArray arrayWithObjects:@"-listnetworkserviceorder", nil]];
+ [[[task standardOutput] fileHandleForReading] readToEndOfFileInBackgroundAndNotify];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(servicesFromTask:) name:NSFileHandleReadToEndOfFileCompletionNotification object:[[task standardOutput] fileHandleForReading]];
[task launch];
}
@@ -360,15 +361,15 @@ - (NSString *)_getDeviceNameForIP:(NSString *)ip
{
NSTask *task;
NSString *result = nil;
- NSData *data;
NSFileHandle *outputFileHandle;
task = [self taskWithLaunchPath:ROUTE_PATH arguments:[NSArray arrayWithObjects:@"get", ip, nil]];
outputFileHandle = [[task standardOutput] fileHandleForReading];
+ [outputFileHandle waitForDataInBackgroundAndNotify];
[task launch];
+ [task waitUntilExit];
- data = [outputFileHandle readDataToEndOfFile];
- NSString *allLines = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ NSString *allLines = [[NSString alloc] initWithData:[outputFileHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];
NSUInteger index = 0;
NSUInteger endOfData = 0;
NSUInteger endLine = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.