Skip to content

Commit 3f99ff1

Browse files
author
Andrew Or
committed
Move destroy to finally block
Per comment in #4320.
1 parent 9a62188 commit 3f99ff1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,15 @@ class SparkSubmitSuite
499499
Seq("./bin/spark-submit") ++ args,
500500
new File(sparkHome),
501501
Map("SPARK_TESTING" -> "1", "SPARK_HOME" -> sparkHome))
502-
val exitCode = failAfter(60 seconds) { process.waitFor() }
503-
// Ensure we still kill the process in case it timed out
504-
process.destroy()
505-
// If the process did not return cleanly, fail the test
506-
if (exitCode != 0) {
507-
fail(s"Process returned with exit code $exitCode. See the log4j logs for more detail.")
502+
503+
try {
504+
val exitCode = failAfter(60 seconds) { process.waitFor() }
505+
if (exitCode != 0) {
506+
fail(s"Process returned with exit code $exitCode. See the log4j logs for more detail.")
507+
}
508+
} finally {
509+
// Ensure we still kill the process in case it timed out
510+
process.destroy()
508511
}
509512
}
510513

0 commit comments

Comments
 (0)