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:
committed by
Facebook GitHub Bot
parent
c52925ce6f
commit
53e612ff6f
@@ -20,6 +20,7 @@ import {ServerPorts} from '../reducers/application';
|
||||
import {Client as ADBClient} from 'adbkit';
|
||||
import {addErrorNotification} from '../reducers/notifications';
|
||||
import {destroyDevice} from '../reducers/connections';
|
||||
import {join} from 'path';
|
||||
|
||||
function createDevice(
|
||||
adbClient: ADBClient,
|
||||
@@ -140,15 +141,17 @@ export default (store: Store, logger: Logger) => {
|
||||
const watchAndroidDevices = () => {
|
||||
// get emulators
|
||||
promisify(which)('emulator')
|
||||
.catch(
|
||||
() =>
|
||||
`${
|
||||
process.env.ANDROID_HOME || process.env.ANDROID_SDK_ROOT || ''
|
||||
}/tools/emulator`,
|
||||
.catch(() =>
|
||||
join(
|
||||
process.env.ANDROID_HOME || process.env.ANDROID_SDK_ROOT || '',
|
||||
'tools',
|
||||
'emulator',
|
||||
),
|
||||
)
|
||||
.then((emulatorPath) => {
|
||||
child_process.exec(
|
||||
`${emulatorPath} -list-avds`,
|
||||
child_process.execFile(
|
||||
emulatorPath as string,
|
||||
['-list-avds'],
|
||||
(error: Error | null, data: string | null) => {
|
||||
if (error != null || data == null) {
|
||||
console.warn('List AVD failed: ', error);
|
||||
@@ -161,9 +164,12 @@ export default (store: Store, logger: Logger) => {
|
||||
});
|
||||
},
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn('Failed to query AVDs:', err);
|
||||
});
|
||||
|
||||
getAdbClient(store)
|
||||
return getAdbClient(store)
|
||||
.then((client) => {
|
||||
client
|
||||
.trackDevices()
|
||||
|
||||
Reference in New Issue
Block a user