def RunSimctlCommand(command):
    'Runs simctl command.'
    for i in range(_SIMCTL_MAX_ATTEMPTS):
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        (stdout, stderr) = process.communicate()
        if (ios_constants.CORESIMULATOR_CHANGE_ERROR in stderr):
            output = stdout
        else:
            output = '\n'.join([stdout, stderr])
        output = output.strip()
        if (process.poll() != 0):
            if ((i < (_SIMCTL_MAX_ATTEMPTS - 1)) and (ios_constants.CORESIMULATOR_INTERRUPTED_ERROR in output)):
                continue
            raise ios_errors.SimError(output)
        return output
Runs simctl command.
def RunSimctlCommand(command):
    
    for i in range(_SIMCTL_MAX_ATTEMPTS):
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        (stdout, stderr) = process.communicate()
        if (ios_constants.CORESIMULATOR_CHANGE_ERROR in stderr):
            output = stdout
        else:
            output = '\n'.join([stdout, stderr])
        output = output.strip()
        if (process.poll() != 0):
            if ((i < (_SIMCTL_MAX_ATTEMPTS - 1)) and (ios_constants.CORESIMULATOR_INTERRUPTED_ERROR in output)):
                continue
            raise ios_errors.SimError(output)
        return output