Debian Codegraph @

infra/bots/recipe_modules/flavor/resources/run_sh.py

raw
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
6 import subprocess
7 import sys
8
9 bin_dir = sys.argv[1]
10 sh = sys.argv[2]
11 adb = sys.argv[3]
12 subprocess.check_call([adb, 'shell', 'sh', bin_dir + sh])
13 try:
14 sys.exit(int(subprocess.check_output([
15 adb, 'shell', 'cat', bin_dir + 'rc']).decode('utf-8')))
16 except ValueError:
17 print("Couldn't read the return code. Probably killed for OOM.")
18 sys.exit(1)