Skip to content

Commit

Permalink
improve: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hsjobeki committed Dec 6, 2022
1 parent ec84c09 commit 6520636
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions src/subsystems/nodejs/builders/granular-nodejs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
Expand Down

0 comments on commit 6520636

Please sign in to comment.