From 385d9ded57ea2fdbf91f87a2b9eec59d0edafe6c Mon Sep 17 00:00:00 2001 From: John Knox Date: Tue, 9 Jul 2019 07:59:52 -0700 Subject: [PATCH] Don't create adb client during module import Summary: Creation of the adb client requires the logger to already be initialized, so this should never be called at the global scope in a module, or you'll get weird import-order related bugs. I noticed this while debugging, I don't think it's impacting anything right now, but have made it lazy just to avoid confusion in future. Reviewed By: passy Differential Revision: D16162266 fbshipit-source-id: 5363292d5cfcf2867a2654777cd8f4baed01d2c0 --- src/utils/androidContainerUtilityInternal.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils/androidContainerUtilityInternal.js b/src/utils/androidContainerUtilityInternal.js index 5e33b922c..bd5281ef2 100644 --- a/src/utils/androidContainerUtilityInternal.js +++ b/src/utils/androidContainerUtilityInternal.js @@ -19,8 +19,6 @@ const appNotDebuggableRegex = /debuggable/; const operationNotPermittedRegex = /not permitted/; const logTag = 'androidContainerUtility'; -const adb = getAdbClient(); - export opaque type AppName = string; export opaque type Command = string; export opaque type FilePath = string; @@ -77,7 +75,7 @@ function executeCommandAsApp( app: string, command: string, ): Promise { - return adb + return getAdbClient() .then(client => client.shell(deviceId, `echo '${command}' | run-as '${app}'`), )