From 0d2ce68d5006214a5aa4c5b7e98c9073f135db7c Mon Sep 17 00:00:00 2001 From: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:53:41 +0100 Subject: [PATCH] mach: ohos: Print error message when hvigor fails (#34267) `hvigorw --version` might fail if some required environment variables are not set. In this case we should print the output of the command, so that the user can report what caused `hvigorw --version` to fail. Signed-off-by: Jonathan Schwender --- python/servo/package_commands.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index e8c2a6e6460..0ecc376f93d 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -224,6 +224,12 @@ class PackageCommands(CommandBase): "path to hvigorw or set the HVIGOR_PATH environment variable to the npm" "installation containing `node_modules` directory with hvigor modules.") sys.exit(1) + except subprocess.CalledProcessError as e: + print(f"hvigor exited with the following error: {e}") + print(f"stdout: `{e.stdout}`") + print(f"stderr: `{e.stderr}`") + sys.exit(1) + else: env["NODE_PATH"] = env["HVIGOR_PATH"] + "/node_modules" hvigor_script = f"{env['HVIGOR_PATH']}/node_modules/@ohos/hvigor/bin/hvigor.js"