Fix emulator usage on linux
Summary: emulator isn't on the path in CI machines, but we already have ANDROID_HOME set so we can work out where it is. Reviewed By: danielbuechele Differential Revision: D15080422 fbshipit-source-id: 2c50a3de27909d2bfc82ea0210d06a0cc32357d7
This commit is contained in:
committed by
Facebook Github Bot
parent
221bf1cc75
commit
a4164c89a0
@@ -40,6 +40,7 @@ class DevicesButton extends Component<Props> {
|
||||
// On Linux, you must run the emulator from the directory it's in because
|
||||
// reasons ...
|
||||
whichPromise('emulator')
|
||||
.catch(e => `${process.env.ANDROID_HOME || ''}/tools/emulator`)
|
||||
.then(emulatorPath => {
|
||||
const child = spawn(emulatorPath, [`@${name}`], {
|
||||
detached: true,
|
||||
|
||||
@@ -64,22 +64,24 @@ function getRunningEmulatorName(id: string): Promise<?string> {
|
||||
export default (store: Store, logger: Logger) => {
|
||||
const watchAndroidDevices = () => {
|
||||
// get emulators
|
||||
promisify(which)('emulator').then(emulatorPath => {
|
||||
child_process.exec(
|
||||
`${emulatorPath} -list-avds`,
|
||||
(error: ?Error, data: ?string) => {
|
||||
if (error != null || data == null) {
|
||||
console.error(error || 'Failed to list AVDs');
|
||||
return;
|
||||
}
|
||||
const payload = data.split('\n').filter(Boolean);
|
||||
store.dispatch({
|
||||
type: 'REGISTER_ANDROID_EMULATORS',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
promisify(which)('emulator')
|
||||
.catch(e => `${process.env.ANDROID_HOME || ''}/tools/emulator`)
|
||||
.then(emulatorPath => {
|
||||
child_process.exec(
|
||||
`${emulatorPath} -list-avds`,
|
||||
(error: ?Error, data: ?string) => {
|
||||
if (error != null || data == null) {
|
||||
console.error(error || 'Failed to list AVDs');
|
||||
return;
|
||||
}
|
||||
const payload = data.split('\n').filter(Boolean);
|
||||
store.dispatch({
|
||||
type: 'REGISTER_ANDROID_EMULATORS',
|
||||
payload,
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
getAdbClient()
|
||||
.then(client => {
|
||||
|
||||
Reference in New Issue
Block a user