Skip to content

Commit

Permalink
redirect ideviceinstaller stdout to plist path (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoyang7 authored Nov 17, 2020
1 parent b3a8f78 commit 182136a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lyrebird_ios/ios_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 182136a

Please sign in to comment.