support DEVICE_SET_PATH env var

Summary: support for DEVICE_SET_PATH as used by 1W

Reviewed By: passy

Differential Revision: D14007285

fbshipit-source-id: 79f40355020c67efcb439f470af2fc35ec7fea7e
This commit is contained in:
Daniel Büchele
2019-02-11 02:54:40 -08:00
committed by Facebook Github Bot
parent 6431d374c2
commit c98047bbcf
2 changed files with 15 additions and 3 deletions

View File

@@ -63,10 +63,15 @@ export default class IOSDevice extends BaseDevice {
return; return;
} }
if (!this.log) { if (!this.log) {
const deviceSetPath = process.env.DEVICE_SET_PATH
? ['--set', process.env.DEVICE_SET_PATH]
: [];
this.log = child_process.spawn( this.log = child_process.spawn(
'xcrun', 'xcrun',
[ [
'simctl', 'simctl',
...deviceSetPath,
'spawn', 'spawn',
'booted', 'booted',
'log', 'log',

View File

@@ -100,9 +100,16 @@ function queryDevices(store: Store, logger: Logger): Promise<void> {
} }
function getActiveSimulators(): Promise<Array<IOSDeviceParams>> { function getActiveSimulators(): Promise<Array<IOSDeviceParams>> {
return promisify(execFile)('xcrun', ['simctl', 'list', 'devices', '--json'], { const deviceSetPath = process.env.DEVICE_SET_PATH
? ['--set', process.env.DEVICE_SET_PATH]
: [];
return promisify(execFile)(
'xcrun',
['simctl', ...deviceSetPath, 'list', 'devices', '--json'],
{
encoding: 'utf8', encoding: 'utf8',
}) },
)
.then(({stdout}) => JSON.parse(stdout).devices) .then(({stdout}) => JSON.parse(stdout).devices)
.then(simulatorDevices => { .then(simulatorDevices => {
const simulators: Array<iOSSimulatorDevice> = Object.values( const simulators: Array<iOSSimulatorDevice> = Object.values(