-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e511375
commit ac8e1ed
Showing
5 changed files
with
66 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {CLIError} from '@react-native-community/cli-tools'; | ||
import child_process from 'child_process'; | ||
import {Device} from '../types'; | ||
|
||
const getSimulators = () => { | ||
let simulators: {devices: {[index: string]: Array<Device>}}; | ||
|
||
try { | ||
simulators = JSON.parse( | ||
child_process.execFileSync( | ||
'xcrun', | ||
['simctl', 'list', '--json', 'devices'], | ||
{encoding: 'utf8'}, | ||
), | ||
); | ||
} catch (error) { | ||
throw new CLIError( | ||
'Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.', | ||
); | ||
} | ||
return simulators; | ||
}; | ||
|
||
export default getSimulators; |