Commit 58e013c4 authored by Ian Fischer's avatar Ian Fischer

Merge pull request #960 from iansf/fix_ios_deploy_crashes

Avoid crashing when an iOS device isn't connected
parents 1e61314e 17d89f3d
......@@ -465,6 +465,7 @@ class IOSDevice(object):
return False
if cls._is_connected:
return True
try:
cmd = [
'ios-deploy',
'--detect',
......@@ -475,12 +476,15 @@ class IOSDevice(object):
out = subprocess.check_output(cmd)
match = re.search(r'\[\.\.\.\.\] Found [^\)]*\) connected', out)
cls._is_connected = match is not None
except subprocess.CalledProcessError:
cls._is_connected = False
return cls._is_connected
@classmethod
def install_app(cls, ios_app_path):
if not cls.has_ios_deploy():
return
try:
cmd = [
'ios-deploy',
'--justlaunch',
......@@ -491,11 +495,14 @@ class IOSDevice(object):
]
logging.info(' '.join(cmd))
subprocess.check_call(cmd)
except subprocess.CalledProcessError:
pass
@classmethod
def copy_file(cls, bundle_id, local_path, device_path):
if not cls.has_ios_deploy():
return
try:
cmd = [
'ios-deploy',
'-t',
......@@ -509,6 +516,8 @@ class IOSDevice(object):
]
logging.info(' '.join(cmd))
subprocess.check_call(cmd)
except subprocess.CalledProcessError:
pass
class IOSSimulator(object):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment