Bugfix: Bad files descriptor should be history now.

Had this multiple times in a row, but after the change I have't seen any to date.
This commit is contained in:
André Berg
2010-03-24 16:29:00 +01:00
parent 1922798d4a
commit a3ede54889
+3 -3
View File
@@ -48,7 +48,7 @@
NSLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
#endif
NSPipe* pipe = [NSPipe pipe];
NSPipe* pipe = [[NSPipe alloc] init];
[task setStandardOutput:pipe];
[task setStandardError:pipe];
return task;
@@ -74,8 +74,8 @@
NSFileHandle * handle = [[task standardOutput] fileHandleForReading];
if (input) {
[task setStandardInput:[NSPipe pipe]];
NSFileHandle * inHandle = [task.standardInput fileHandleForWriting];
[task setStandardInput:[[NSPipe alloc] init]];
NSFileHandle * inHandle = [[task standardInput] fileHandleForWriting];
[inHandle writeData:[input dataUsingEncoding:NSUTF8StringEncoding]];
[inHandle closeFile];
}