Skip to content

Commit df67cde

Browse files
committed
Switch back to try to capture things besinds non-zero exit values
1 parent 91aabd2 commit df67cde

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/test/scala/org/apache/spark/rdd/PipedRDDSuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import java.io.File
2222
import scala.collection.Map
2323
import scala.io.Codec
2424
import scala.sys.process._
25+
import scala.util.Try
2526

2627
import org.apache.hadoop.fs.Path
2728
import org.apache.hadoop.io.{LongWritable, Text}
@@ -213,7 +214,8 @@ class PipedRDDSuite extends SparkFunSuite with SharedSparkContext {
213214
}
214215

215216
def testCommandAvailable(command: String): Boolean = {
216-
Process(command).run().exitValue() == 0
217+
val attempt = Try(Process(command).run().exitValue())
218+
attempt.isSuccess && attempt.get == 0
217219
}
218220

219221
def testExportInputFile(varName: String) {

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.apache.spark.sql.hive.execution
2020
import java.sql.{Date, Timestamp}
2121

2222
import scala.sys.process.Process
23+
import scala.util.Try
2324

2425
import org.apache.hadoop.fs.Path
2526

@@ -1773,6 +1774,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
17731774
}
17741775

17751776
def testCommandAvailable(command: String): Boolean = {
1776-
Process(command).run().exitValue() == 0
1777+
val attempt = Try(Process(command).run().exitValue())
1778+
attempt.isSuccess && attempt.get == 0
17771779
}
17781780
}

0 commit comments

Comments
 (0)