Permalink
Browse files

Hopefully the final fix to RealMongoSpecSupport

  • Loading branch information...
1 parent 15e9f7f commit e223a579dda3aaf62cf3d4f992b9e6a97e71275b @dchenbecker dchenbecker committed Jan 13, 2013
Showing with 14 additions and 12 deletions.
  1. +14 −12 mongo/src/main/scala/blueeyes/persistence/mongo/RealMongoSpecSupport.scala
@@ -160,21 +160,23 @@ trait RealMongoSpecSupport extends Specification {
}
def shutdown(): Unit = {
- try {
- Await.result(mongo.asInstanceOf[RealMongo].close, Timeout(60, TimeUnit.SECONDS).duration)
- } catch {
- case t => mongoLogger.warn("Error during BlueEyes mongo shutdown", t)
- } finally {
- mongoProcess.foreach { process =>
- try {
+ IO {
+ Await.result(mongo.asInstanceOf[RealMongo].close, Timeout(60, TimeUnit.SECONDS).duration)
+ }.ensuring {
+ IO {
+ mongoProcess.foreach { process =>
process.destroy()
- } catch {
- case t: Throwable => mongoLogger.warn("Error during RealMongoSpecSupport shutdown", t)
- } finally {
- dataDir.listFiles.foreach(FileUtils.deleteQuietly(_))
+ }
+ }.ensuring {
+ IO {
+ if (dataDir.isDirectory) {
+ dataDir.listFiles.foreach(FileUtils.deleteQuietly(_))
+ }
}
}
- }
+ }.except {
+ case t: Throwable => mongoLogger.warn("Error during BlueEyes mongo shutdown", t); IO(())
+ }.unsafePerformIO
}
override def map (fs: => Fragments): Fragments = Step { startup() } ^ fs ^ Step { shutdown() }

0 comments on commit e223a57

Please sign in to comment.