From 65206360327268d20ce90177f60a98f946056e69 Mon Sep 17 00:00:00 2001 From: hsjobeki Date: Tue, 6 Dec 2022 15:59:29 +0100 Subject: [PATCH] improve: error handling --- .../granular-nodejs/bin_tests/bin_tests/main.py | 14 ++++++++++---- .../nodejs/builders/granular-nodejs/default.nix | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/subsystems/nodejs/builders/granular-nodejs/bin_tests/bin_tests/main.py b/src/subsystems/nodejs/builders/granular-nodejs/bin_tests/bin_tests/main.py index ee1caceefc..1ec1a0f428 100644 --- a/src/subsystems/nodejs/builders/granular-nodejs/bin_tests/bin_tests/main.py +++ b/src/subsystems/nodejs/builders/granular-nodejs/bin_tests/bin_tests/main.py @@ -75,17 +75,23 @@ def is_binary(f: Path) -> bool: def try_args(args: list[str], binary: Path) -> bool: success = False + out = [] for arg in args: try: completed_process = subprocess.run( f"{binary} {arg}".split(" "), timeout=10, - stderr=subprocess.DEVNULL, - stdout=subprocess.DEVNULL, + capture_output=True, ) if completed_process.returncode == 0: success = True break - except subprocess.SubprocessError: - pass + else: + out.append(completed_process.stdout.decode()) + out.append(completed_process.stderr.decode()) + + except subprocess.SubprocessError as e: + print(e) + if not success: + print("\n".join(out)) return success diff --git a/src/subsystems/nodejs/builders/granular-nodejs/default.nix b/src/subsystems/nodejs/builders/granular-nodejs/default.nix index a3233079ff..a6f043eb43 100644 --- a/src/subsystems/nodejs/builders/granular-nodejs/default.nix +++ b/src/subsystems/nodejs/builders/granular-nodejs/default.nix @@ -285,9 +285,10 @@ }; # check all binaries of the top level package - doInstallCheck = isMainPackage packageName version; + # doInstallCheck = isMainPackage packageName version; + doInstallCheck = true; # list of binaries that cannot be tested - installCheckExcludes = []; + installCheckExcludes = ["tsserver"]; installCheckPhase = '' ${binTestApp}/bin/d2nCheck '';