Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: testing/iossim/iossim.mm

Issue 2240373002: [iossim] Work around pipe hang on some macs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/iossim/iossim.mm
diff --git a/testing/iossim/iossim.mm b/testing/iossim/iossim.mm
index f1f0ca86c6e345b59caad9aa46cbf4d9ef8ead24..e5317b8fb4adbc484d95de5ef7df6149fcd9428f 100644
--- a/testing/iossim/iossim.mm
+++ b/testing/iossim/iossim.mm
@@ -89,6 +89,14 @@ void LogError(NSString* format, ...) {
[_task waitUntilExit];
}
+- (void)launch {
+ [_task launch];
+}
+
+- (void)waitUntilExit {
+ [_task waitUntilExit];
+}
+
@end
// Return array of available iOS runtime dictionaries. Unavailable (old Xcode
@@ -127,9 +135,16 @@ NSDictionary* GetSimulatorList() {
initWithArguments:@[ @"simctl", @"list", @"-j" ]] autorelease];
NSPipe* out = [NSPipe pipe];
[task setStandardOutput:out];
- [task run];
+ // In the rest of the this file we read from the pipe after -waitUntilExit
+ // (We normally wrap -launch and -waitUntilExit in one -run method). However,
+ // on some swarming slaves this led to a hang on simctl's pipe. Since the
+ // output of simctl is so instant, reading it before exit seems to work, and
+ // seems to avoid the hang.
+ [task launch];
NSData* data = [[out fileHandleForReading] readDataToEndOfFile];
+ [task waitUntilExit];
+
NSError* error = nil;
return [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698