microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
test-microbuild1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/ios/simctl.ts

25lines · modepreview

// 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);
    }
}