DevicesButton
Summary: _typescript_ Reviewed By: jknoxville Differential Revision: D17284473 fbshipit-source-id: 2a0586dc3147338c8335eadb4dcbe158e8f1dc97
This commit is contained in:
committed by
Facebook Github Bot
parent
f2812aff7a
commit
fe6813042c
@@ -48,15 +48,19 @@ class DevicesButton extends Component<Props> {
|
|||||||
// reasons ...
|
// reasons ...
|
||||||
whichPromise('emulator')
|
whichPromise('emulator')
|
||||||
.catch(() => `${process.env.ANDROID_HOME || ''}/tools/emulator`)
|
.catch(() => `${process.env.ANDROID_HOME || ''}/tools/emulator`)
|
||||||
.then((emulatorPath: string) => {
|
.then(emulatorPath => {
|
||||||
const child = spawn(emulatorPath, [`@${name}`], {
|
if (emulatorPath) {
|
||||||
detached: true,
|
const child = spawn(emulatorPath, [`@${name}`], {
|
||||||
cwd: dirname(emulatorPath),
|
detached: true,
|
||||||
});
|
cwd: dirname(emulatorPath),
|
||||||
child.stderr.on('data', data => {
|
});
|
||||||
console.error(`Android emulator error: ${data}`);
|
child.stderr.on('data', data => {
|
||||||
});
|
console.error(`Android emulator error: ${data}`);
|
||||||
child.on('error', console.error);
|
});
|
||||||
|
child.on('error', console.error);
|
||||||
|
} else {
|
||||||
|
throw new Error('Could not get emulator path');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
this.props.preferDevice(name);
|
this.props.preferDevice(name);
|
||||||
@@ -155,7 +159,7 @@ class DevicesButton extends Component<Props> {
|
|||||||
}));
|
}));
|
||||||
if (emulators.length > 0) {
|
if (emulators.length > 0) {
|
||||||
dropdown.push(
|
dropdown.push(
|
||||||
{type: 'separator'},
|
{type: 'separator' as 'separator'},
|
||||||
{
|
{
|
||||||
label: 'Launch Android emulators',
|
label: 'Launch Android emulators',
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -165,7 +169,7 @@ class DevicesButton extends Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dropdown.length > 0) {
|
if (dropdown.length > 0) {
|
||||||
dropdown.push({type: 'separator'});
|
dropdown.push({type: 'separator' as 'separator'});
|
||||||
}
|
}
|
||||||
dropdown.push({
|
dropdown.push({
|
||||||
label: 'Open File...',
|
label: 'Open File...',
|
||||||
|
|||||||
Reference in New Issue
Block a user