Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] fix for first launch of adb (dotnet#1900)
Context: dotnet@77cf939 Since 77cf939, we have been killing adb after tests complete. This causes an issue if you are running a test in an IDE that uses `BaseTest.HasDevices`. The first run will likely work, but the second one fails saying `Test Skipped no devices or emulators found.`. If you run a test, and adb is not already running, consider the following code: var result = RunAdbCommand ($"{adbTarget} shell getprop ro.build.version.sdk"); It will return with: 27* daemon not running; starting now at tcp:5037 * daemon started successfully Since we pass the result to `int.TryParse`, we are treating the command as if it had failed, meaning no devices were attached. To make this more robust, we can split on the `*` character and take the first item. This allows this command to work even if adb is being launched for the first time. Other changes: - We also do not need to call `Trim ()` from the result of `RunAdbCommand` since it already calls `Trim ()`.
- Loading branch information