Introduce emulatur launch dialog
Summary: Changelog: Flipper can now launch iOS simulators by using `File > Launch Emulator...` In the Sandy designs the device selector dropdown no longer shows the option to launch an emulator. So added a button to app inspect and the main menu instead. I found it always a bit funny that we can launch android emulators, but not iOS emulators. Turns out that launching them is actually not very complex, so added capabilities to launch ios emulators Reviewed By: jknoxville Differential Revision: D24021737 fbshipit-source-id: c106cc2246921e008f9c808ebb811d8e333aa93b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4e6ecac43e
commit
17baa3084c
@@ -13,6 +13,9 @@ import {Priority} from 'adbkit-logcat';
|
||||
import ArchivedDevice from './ArchivedDevice';
|
||||
import {createWriteStream} from 'fs';
|
||||
import type {LogLevel, DeviceType} from 'flipper-plugin';
|
||||
import which from 'which';
|
||||
import {spawn} from 'child_process';
|
||||
import {dirname} from 'path';
|
||||
|
||||
const DEVICE_RECORDING_DIR = '/sdcard/flipper_recorder';
|
||||
|
||||
@@ -189,3 +192,24 @@ export default class AndroidDevice extends BaseDevice {
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
|
||||
export async function launchEmulator(name: string) {
|
||||
// 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),
|
||||
});
|
||||
child.stderr.on('data', (data) => {
|
||||
console.error(`Android emulator error: ${data}`);
|
||||
});
|
||||
child.on('error', (e) => console.error(e));
|
||||
} else {
|
||||
throw new Error('Could not get emulator path');
|
||||
}
|
||||
})
|
||||
.catch((e) => console.error(e));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user