diff --git a/lyrebird_ios/ios_helper.py b/lyrebird_ios/ios_helper.py index 5026792..0f94fb2 100644 --- a/lyrebird_ios/ios_helper.py +++ b/lyrebird_ios/ios_helper.py @@ -41,7 +41,11 @@ def check_environment(): if err_str or code or not output: raise LibmobiledeviceError(f'Get libmobiledevice info error: {err_str}') - libimobiledevice_info = json.loads(output) + try: + libimobiledevice_info = json.loads(output) + except Exception: + raise LibmobiledeviceError(f'Get unknown libmobiledevice info: {output}') + if not isinstance(libimobiledevice_info, list) and not len(libimobiledevice_info): raise LibmobiledeviceError(f'Get unknown libmobiledevice info: {output}') @@ -266,9 +270,11 @@ def get_device_plist(self, device_id): os.mkdir(PLIST_PATH) if not ideviceinstaller: raise IdeviceinstallerError('Command `ideviceinstaller` is not ready! Check your libimobiledevice') - _cmd = f'{ideviceinstaller} -u {self.device_id} -l -o xml > {plist_path}' - p = subprocess.Popen(_cmd, shell=True) - p.wait() + _cmd = f'{ideviceinstaller} -u {self.device_id} -l -o xml' + + with open(plist_path, 'w') as output: + p = subprocess.Popen(_cmd, stdout=output, shell=True) + p.wait() def get_apps_list(self, device_id): self.get_device_plist(device_id) diff --git a/setup.py b/setup.py index c0444cc..4321286 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='lyrebird-ios', - version='0.3.3', + version='0.3.4', packages=['lyrebird_ios'], url='https://github.com/meituan/lyrebird-ios', author='HBQA',