Skip to content

Commit

Permalink
Move destroy to finally block
Browse files Browse the repository at this point in the history
Per comment in apache#4320.
  • Loading branch information
Andrew Or committed Jun 18, 2015
1 parent 9a62188 commit 3f99ff1
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,15 @@ class SparkSubmitSuite
Seq("./bin/spark-submit") ++ args,
new File(sparkHome),
Map("SPARK_TESTING" -> "1", "SPARK_HOME" -> sparkHome))
val exitCode = failAfter(60 seconds) { process.waitFor() }
// Ensure we still kill the process in case it timed out
process.destroy()
// If the process did not return cleanly, fail the test
if (exitCode != 0) {
fail(s"Process returned with exit code $exitCode. See the log4j logs for more detail.")

try {
val exitCode = failAfter(60 seconds) { process.waitFor() }
if (exitCode != 0) {
fail(s"Process returned with exit code $exitCode. See the log4j logs for more detail.")
}
} finally {
// Ensure we still kill the process in case it timed out
process.destroy()
}
}

Expand Down

0 comments on commit 3f99ff1

Please sign in to comment.