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
|
// On Linux, you must run the emulator from the directory it's in because
|
||||||
// reasons ...
|
// reasons ...
|
||||||
whichPromise('emulator')
|
whichPromise('emulator')
|
||||||
|
.catch(e => `${process.env.ANDROID_HOME || ''}/tools/emulator`)
|
||||||
.then(emulatorPath => {
|
.then(emulatorPath => {
|
||||||
const child = spawn(emulatorPath, [`@${name}`], {
|
const child = spawn(emulatorPath, [`@${name}`], {
|
||||||
detached: true,
|
detached: true,
|
||||||
|
|||||||
@@ -64,22 +64,24 @@ function getRunningEmulatorName(id: string): Promise<?string> {
|
|||||||
export default (store: Store, logger: Logger) => {
|
export default (store: Store, logger: Logger) => {
|
||||||
const watchAndroidDevices = () => {
|
const watchAndroidDevices = () => {
|
||||||
// get emulators
|
// get emulators
|
||||||
promisify(which)('emulator').then(emulatorPath => {
|
promisify(which)('emulator')
|
||||||
child_process.exec(
|
.catch(e => `${process.env.ANDROID_HOME || ''}/tools/emulator`)
|
||||||
`${emulatorPath} -list-avds`,
|
.then(emulatorPath => {
|
||||||
(error: ?Error, data: ?string) => {
|
child_process.exec(
|
||||||
if (error != null || data == null) {
|
`${emulatorPath} -list-avds`,
|
||||||
console.error(error || 'Failed to list AVDs');
|
(error: ?Error, data: ?string) => {
|
||||||
return;
|
if (error != null || data == null) {
|
||||||
}
|
console.error(error || 'Failed to list AVDs');
|
||||||
const payload = data.split('\n').filter(Boolean);
|
return;
|
||||||
store.dispatch({
|
}
|
||||||
type: 'REGISTER_ANDROID_EMULATORS',
|
const payload = data.split('\n').filter(Boolean);
|
||||||
payload,
|
store.dispatch({
|
||||||
});
|
type: 'REGISTER_ANDROID_EMULATORS',
|
||||||
},
|
payload,
|
||||||
);
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
getAdbClient()
|
getAdbClient()
|
||||||
.then(client => {
|
.then(client => {
|
||||||
|
|||||||
Reference in New Issue
Block a user