Add option to cold boot emulators
Summary: This is useful when your emulator freezes. Reviewed By: mweststrate Differential Revision: D25998579 fbshipit-source-id: 236c16c3008f0e33d62e4c486b5a04383b1a59ba
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d77940a839
commit
3e911c8288
@@ -202,16 +202,20 @@ export default class AndroidDevice extends BaseDevice {
|
||||
}
|
||||
}
|
||||
|
||||
export async function launchEmulator(name: string) {
|
||||
export async function launchEmulator(name: string, coldBoot: boolean = false) {
|
||||
// On Linux, you must run the emulator from the directory it's in because
|
||||
// reasons ...
|
||||
return which('emulator')
|
||||
.then((emulatorPath) => {
|
||||
if (emulatorPath) {
|
||||
const child = spawn(emulatorPath, [`@${name}`], {
|
||||
detached: true,
|
||||
cwd: dirname(emulatorPath),
|
||||
});
|
||||
const child = spawn(
|
||||
emulatorPath,
|
||||
[`@${name}`, ...(coldBoot ? ['-no-snapshot-load'] : [])],
|
||||
{
|
||||
detached: true,
|
||||
cwd: dirname(emulatorPath),
|
||||
},
|
||||
);
|
||||
child.stderr.on('data', (data) => {
|
||||
console.error(`Android emulator error: ${data}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user