1# Copyright 2024 Google LLC 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import subprocess 7import sys 8 9bin_dir = sys.argv[1] 10sh = sys.argv[2] 11adb = sys.argv[3] 12subprocess.check_call([adb, 'shell', 'sh', bin_dir + sh]) 13try: 14 sys.exit(int(subprocess.check_output([ 15 adb, 'shell', 'cat', bin_dir + 'rc']).decode('utf-8'))) 16except ValueError: 17 print("Couldn't read the return code. Probably killed for OOM.") 18 sys.exit(1) 19