Update *run* method

This commit is contained in:
Rikka 2023-01-12 02:33:51 +08:00
parent 4b83449e3b
commit 325dbb472a
No known key found for this signature in database
GPG key ID: 27646650E3A52AAF

View file

@ -62,12 +62,15 @@ def restart():
DBusContainerService().Start(waydroid_session) DBusContainerService().Start(waydroid_session)
def run(args): def run(args):
try: result = subprocess.run(args=args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = subprocess.run(args=args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if result.stderr:
result.check_returncode() print(result.stderr.decode("utf-8"))
except subprocess.CalledProcessError as e: raise subprocess.CalledProcessError(
print("\nOutput: ", e.stderr.decode("utf-8") ) returncode = result.returncode,
raise cmd = result.args,
stderr = result.stderr
)
return result
def install_gapps(): def install_gapps():
@ -153,8 +156,8 @@ def get_android_id():
sqs = """ sqs = """
SELECT * FROM main WHERE name='android_id' SELECT * FROM main WHERE name='android_id'
""" """
queryout = subprocess.check_output(["sqlite3", "/var/lib/waydroid/data/data/com.google.android.gsf/databases/gservices.db", sqs.strip()], stderr=subprocess.STDOUT) queryout = run(["sqlite3", "/var/lib/waydroid/data/data/com.google.android.gsf/databases/gservices.db", sqs.strip()])
print(queryout.decode().replace("android_id|", "").strip()) print(queryout.stdout.decode().replace("android_id|", "").strip())
print(" ^----- Open https://google.com/android/uncertified/?pli=1") print(" ^----- Open https://google.com/android/uncertified/?pli=1")
print(" Login with your google id then submit the form with id shown above") print(" Login with your google id then submit the form with id shown above")
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e: