microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/extension/ios/simctl.ts
24lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | import { ChildProcess } from "../../common/node/childProcess"; |
| 5 | |
| 6 | const childProcess: ChildProcess = new ChildProcess(); |
| 7 | |
| 8 | export class SimctrlHelper { |
| 9 | public static async getBootediOSSimulatorList(): Promise<string[]> { |
| 10 | const getBootedSimulatorCommand = |
| 11 | "xcrun simctl list | awk -F'[()]' '/(Booted)/ { print $2 }'"; |
| 12 | |
| 13 | const targetResult = await childProcess.execToString(getBootedSimulatorCommand); |
| 14 | const targetList = targetResult.split("\n"); |
| 15 | return targetList; |
| 16 | } |
| 17 | |
| 18 | public static async installApplicationToSimulator( |
| 19 | targetId: string, |
| 20 | appPath: string, |
| 21 | ): Promise<void> { |
| 22 | await childProcess.execFileToString("xcrun", ["simctl", "install", targetId, appPath]); |
| 23 | } |
| 24 | } |
| 25 | |