format import { reportPlatformFailures } from 'flipper-common' ; import { execFile } from 'promisify-child-process' ; import adbConfig from './adbConfig' ; import adbkit , { Client } from 'adbkit' ; import path from 'path' ; let instance ; type Config = { androidHome : string ; } ; export async function getAdbClient ( config ) { if ( ! instance ) { instance = await reportPlatformFailures ( createClient ( config ) , 'createADBClient' ) ; } return instance ; } async function createClient ( config ) { const androidHome = config . androidHome ; const adbPath = path . resolve ( androidHome , 'platform-tools' , 'adb' ) ; return reportPlatformFailures < Client > ( execFile ( adbPath , [ 'start-server' ] ) . then ( ( ) => adbkit . createClient ( adbConfig ( ) ) ) , 'createADBClient.shell' ) ; }