Fix adb path interpolation on Windows

Summary:
Concatenating strings is not a great idea for paths. This isn't actually Windows-specific (I think) but maybe more common there. If you have a space as part of your ADB path, you're in for a world of pain.

This addressed a couple of issues but I'm sure there are more when you use it for more detailed use cases.

Closes https://github.com/facebook/flipper/issues/2438

Reviewed By: mweststrate

Differential Revision: D29061367

fbshipit-source-id: 001e498ac42bd8df6e6852be9b42fb5f38379c2e
This commit is contained in:
Pascal Hartig
2021-06-11 06:29:46 -07:00
committed by Facebook GitHub Bot
parent c52925ce6f
commit 53e612ff6f
4 changed files with 27 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
*/
import {reportPlatformFailures} from './metrics';
import {exec} from 'promisify-child-process';
import {execFile} from 'promisify-child-process';
import promiseRetry from 'promise-retry';
import adbConfig from '../utils/adbConfig';
import adbkit, {Client} from 'adbkit';
@@ -32,7 +32,7 @@ function createClient(store: Store): Promise<Client> {
const androidHome = store.getState().settingsState.androidHome;
const adbPath = path.resolve(androidHome, 'platform-tools/adb');
return reportPlatformFailures<Client>(
exec(`${adbPath} start-server`).then(() =>
execFile(adbPath, ['start-server']).then(() =>
adbkit.createClient(adbConfig()),
),
'createADBClient.shell',