Skip to content

Commit

Permalink
set exit code to -1 if failed
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchun-li committed Jun 29, 2017
1 parent 51483ff commit 515f502
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions droidbot/droidbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,20 @@ def __init__(self,
# # FIXED by requiring device_serial in cmd
# device_serial = '.*'

self.device = Device(device_serial=device_serial,
output_dir=self.output_dir,
use_hierarchy_viewer=use_hierarchy_viewer,
grant_perm=grant_perm)
self.app = App(app_path, output_dir=self.output_dir)

self.device = None
self.app = None
self.droidbox = None
self.env_manager = None
self.event_manager = None

self.enabled = True

try:
self.device.set_up()
self.device.connect()
self.device = Device(device_serial=device_serial,
output_dir=self.output_dir,
use_hierarchy_viewer=use_hierarchy_viewer,
grant_perm=grant_perm)
self.app = App(app_path, output_dir=self.output_dir)

if with_droidbox:
self.droidbox = DroidBox(droidbot=self, output_dir=self.output_dir)
Expand All @@ -91,10 +90,11 @@ def __init__(self,
script_path=script_path,
profiling_method=profiling_method)
except Exception as e:
self.logger.warning("Something went wrong: " + e.message)
import traceback
traceback.print_exc()
self.stop()
print e
sys.exit(-1)

@staticmethod
def get_instance():
Expand All @@ -112,6 +112,9 @@ def start(self):
return
self.logger.info("Starting DroidBot")
try:
self.device.set_up()
self.device.connect()

self.device.install_app(self.app)
self.env_manager.deploy()

Expand All @@ -130,7 +133,8 @@ def start(self):
self.logger.warning("Something went wrong: " + e.message)
import traceback
traceback.print_exc()
pass
self.stop()
sys.exit(-1)

self.stop()
self.logger.info("DroidBot Stopped")
Expand Down

0 comments on commit 515f502

Please sign in to comment.