fail early with message when hardhat binary not found

# Conflicts:
#	tests/integration/hardhatprocess.nim
This commit is contained in:
Eric 2025-01-21 12:38:32 +11:00
parent 4790b54fd2
commit 5b491b3705
No known key found for this signature in database

View File

@ -8,6 +8,7 @@ import pkg/stew/io2
import std/os
import std/sets
import std/sequtils
import std/strformat
import std/strutils
import pkg/codex/conf
import pkg/codex/utils/trackedfutures
@ -58,6 +59,14 @@ proc openLogFile(node: HardhatProcess, logFilePath: string): IoHandle =
return fileHandle
method start*(node: HardhatProcess) {.async.} =
logScope:
nodeName = node.name
if not fileExists(node.executable):
raiseAssert "cannot start hardhat, binary doesn't exist (looking for " &
&"{absolutePath(node.workingDir / node.executable)}). Try running " &
&"`npm install` in {node.workingDir}."
let poptions = node.processOptions + {AsyncProcessOption.StdErrToStdOut}
trace "starting node",
args = node.arguments,