OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 #include <asl.h> | 6 #include <asl.h> |
7 #include <libgen.h> | 7 #include <libgen.h> |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 | 10 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // window). As a workaround, iossim creates a temp file to hold output, which | 313 // window). As a workaround, iossim creates a temp file to hold output, which |
314 // this method reads and copies to stdout. | 314 // this method reads and copies to stdout. |
315 - (void)tailOutputForSession:(DTiPhoneSimulatorSession*)session { | 315 - (void)tailOutputForSession:(DTiPhoneSimulatorSession*)session { |
316 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | 316 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; |
317 | 317 |
318 NSFileHandle* simio = [NSFileHandle fileHandleForReadingAtPath:stdioPath_]; | 318 NSFileHandle* simio = [NSFileHandle fileHandleForReadingAtPath:stdioPath_]; |
319 if (IsRunningWithXcode6OrLater()) { | 319 if (IsRunningWithXcode6OrLater()) { |
320 #if defined(IOSSIM_USE_XCODE_6) | 320 #if defined(IOSSIM_USE_XCODE_6) |
321 // With iOS 8 simulators on Xcode 6, the app output is relative to the | 321 // With iOS 8 simulators on Xcode 6, the app output is relative to the |
322 // simulator's data directory. | 322 // simulator's data directory. |
323 if ([session.sessionConfig.simulatedSystemRoot.sdkVersion isEqual:@"8.0"]) { | 323 NSString* versionString = |
| 324 [[[session sessionConfig] simulatedSystemRoot] sdkVersion]; |
| 325 NSInteger majorVersion = [[[versionString componentsSeparatedByString:@"."] |
| 326 objectAtIndex:0] intValue]; |
| 327 if (majorVersion >= 8) { |
324 NSString* dataPath = session.sessionConfig.device.dataPath; | 328 NSString* dataPath = session.sessionConfig.device.dataPath; |
325 NSString* appOutput = | 329 NSString* appOutput = |
326 [dataPath stringByAppendingPathComponent:stdioPath_]; | 330 [dataPath stringByAppendingPathComponent:stdioPath_]; |
327 simio = [NSFileHandle fileHandleForReadingAtPath:appOutput]; | 331 simio = [NSFileHandle fileHandleForReadingAtPath:appOutput]; |
328 } | 332 } |
329 #endif // IOSSIM_USE_XCODE_6 | 333 #endif // IOSSIM_USE_XCODE_6 |
330 } | 334 } |
331 NSFileHandle* standardOutput = [NSFileHandle fileHandleWithStandardOutput]; | 335 NSFileHandle* standardOutput = [NSFileHandle fileHandleWithStandardOutput]; |
332 // Copy data to stdout/stderr while the app is running. | 336 // Copy data to stdout/stderr while the app is running. |
333 while (appRunning_) { | 337 while (appRunning_) { |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 [error localizedDescription], | 1012 [error localizedDescription], |
1009 [error domain], static_cast<long int>([error code])); | 1013 [error domain], static_cast<long int>([error code])); |
1010 } | 1014 } |
1011 | 1015 |
1012 // Note that this code is only executed if the simulator fails to start | 1016 // Note that this code is only executed if the simulator fails to start |
1013 // because once the main run loop is started, only the delegate calling | 1017 // because once the main run loop is started, only the delegate calling |
1014 // exit() will end the program. | 1018 // exit() will end the program. |
1015 [pool drain]; | 1019 [pool drain]; |
1016 return kExitFailure; | 1020 return kExitFailure; |
1017 } | 1021 } |
OLD | NEW |