Add -datadir to when obtaining bitcoind -version to avoid using default datadir (#5574)

This commit is contained in:
Chris Stewart 2024-05-08 20:59:53 -05:00 committed by GitHub
parent f300bed25a
commit 18cb4f3ddf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,8 +52,13 @@ sealed trait BitcoindInstanceLocal extends BitcoindInstance {
val binaryPath = binary.getAbsolutePath
val versionT = Try {
val cmd =
Seq(binaryPath, s"-datadir=${datadir.toPath.toString}", "--version")
val foundVersion =
Seq(binaryPath, "--version").!!.split(Properties.lineSeparator).head
cmd
.!!(NativeProcessFactory.processLogger)
.split(Properties.lineSeparator)
.head
.split(" ")
.last
BitcoindVersion.findVersion(foundVersion).getOrElse {
@ -69,7 +74,7 @@ sealed trait BitcoindInstanceLocal extends BitcoindInstance {
case Success(value) => value
case Failure(exception) =>
logger.error("Error getting bitcoind version", exception)
BitcoindVersion.newest
throw exception
}
}
}