Skip to content

Commit 8cf5726

Browse files
author
Jaeho Choi
committed
Modify the Executor to correctly return error messages from failures in each library (#14)
1 parent 7464ab9 commit 8cf5726

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/main/scala/fhetest/Phase/Execute.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ case object Execute {
2121
Process(executeCommand, new File(binPath))
2222
cmakeProcess.!(silentLogger)
2323
makeProcess.!(silentLogger)
24+
25+
val errorSB = new StringBuilder()
2426
try {
25-
val executeResult = executeProcess.!!
26-
executeResult // 성공적으로 완료된 경우, 결과 반환
27+
val errLogger = errorLogger(errorSB)
28+
val executeResult = executeProcess.!!(errLogger)
29+
executeResult // Return the result if it is successfully completed
2730
} catch {
28-
case e: Exception => s"Execution failed: ${e.getMessage}"
31+
case e: Exception => errorSB.toString()
2932
}
3033
}
3134
}

src/main/scala/fhetest/Utils/Utils.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import org.twc.terminator.Main.ENC_TYPE as T2ENC_TYPE
55
import sys.process.*
66
import java.nio.file.{Files, Path, Paths, StandardCopyOption}
77
import java.util.Comparator
8-
import scala.util.Try
98

9+
import scala.util.Try
10+
import scala.collection.mutable.StringBuilder
1011
import scala.concurrent.ExecutionContext.Implicits.global
1112
import scala.concurrent.Future
1213
import java.util.concurrent.atomic.AtomicInteger
@@ -120,6 +121,7 @@ def withBackendTempDir[Result](
120121
}
121122

122123
val silentLogger = ProcessLogger(_ => (), _ => ())
124+
def errorLogger(s: StringBuilder) = ProcessLogger(_ => (), err => s.append(err))
123125

124126
def compare(obtained: String, expected: String): Unit = {
125127
val obtainedLines = obtained.split("\n")

0 commit comments

Comments
 (0)