Reduce error spam from adb start-server

Summary:
We do have a fall-back for this so there's no need to give this error or even
warning treatment. If the fallback fails, we already have a warning.

Reviewed By: mweststrate

Differential Revision: D26547277

fbshipit-source-id: 96ac91def7e6e111d32d3536d8796f347d6c519d
This commit is contained in:
Pascal Hartig
2021-02-22 03:35:55 -08:00
committed by Facebook GitHub Bot
parent c70d97accf
commit 11d2871893

View File

@@ -8,8 +8,7 @@
*/ */
import {reportPlatformFailures} from './metrics'; import {reportPlatformFailures} from './metrics';
import {promisify} from 'util'; import {exec} from 'promisify-child-process';
import child_process from 'child_process';
import promiseRetry from 'promise-retry'; import promiseRetry from 'promise-retry';
import adbConfig from '../utils/adbConfig'; import adbConfig from '../utils/adbConfig';
import adbkit, {Client} from 'adbkit'; import adbkit, {Client} from 'adbkit';
@@ -33,12 +32,12 @@ function createClient(store: Store): Promise<Client> {
const androidHome = store.getState().settingsState.androidHome; const androidHome = store.getState().settingsState.androidHome;
const adbPath = path.resolve(androidHome, 'platform-tools/adb'); const adbPath = path.resolve(androidHome, 'platform-tools/adb');
return reportPlatformFailures<Client>( return reportPlatformFailures<Client>(
promisify(child_process.exec)(`${adbPath} start-server`).then(() => exec(`${adbPath} start-server`).then(() =>
adbkit.createClient(adbConfig()), adbkit.createClient(adbConfig()),
), ),
'createADBClient.shell', 'createADBClient.shell',
).catch((err) => { ).catch((err) => {
console.error( console.log(
'Failed to create adb client using shell adb command. Trying with adbkit.\n' + 'Failed to create adb client using shell adb command. Trying with adbkit.\n' +
err.toString(), err.toString(),
); );