-
Notifications
You must be signed in to change notification settings - Fork 261
/
simctl.ts
25 lines (20 loc) · 934 Bytes
/
simctl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { ChildProcess } from "../../common/node/childProcess";
const childProcess: ChildProcess = new ChildProcess();
export class SimctrlHelper {
public static async getBootediOSSimulatorList(): Promise<string[]> {
const getBootedSimulatorCommand =
"xcrun simctl list | awk -F'[()]' '/(Booted)/ { print $2 }'";
const targetResult = await childProcess.execToString(getBootedSimulatorCommand);
const targetList = targetResult.split("\n");
return targetList;
}
public static async installApplicationToSimulator(
targetId: string,
appPath: string,
): Promise<void> {
const installCommand = `xcrun simctl install ${targetId} ${appPath}`;
await childProcess.execToString(installCommand);
}
}