Skip to content

Commit

Permalink
#129 remove temporary file when the job ends
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Sep 12, 2018
1 parent 334feb1 commit 60956ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/org/thp/cortex/services/JobSrv.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.thp.cortex.services

import java.io.{ ByteArrayOutputStream, InputStream }
import java.nio.file.Files
import java.nio.file.{ Files, Paths }
import java.util.Date
import javax.inject.{ Inject, Singleton }

import javax.inject.{ Inject, Singleton }
import akka.NotUsed
import akka.actor.ActorSystem
import akka.stream.Materializer
Expand Down Expand Up @@ -403,6 +403,11 @@ class JobSrv(
val errorMessage = (error + output).take(8192)
endJob(job, JobStatus.Failure, Some(s"Invalid output\n$errorMessage"))
}
finally {
(input \ "file").asOpt[String].foreach { filename
Files.deleteIfExists(Paths.get(filename))
}
}
}(executionContext)
}

Expand Down

0 comments on commit 60956ae

Please sign in to comment.