Use TMP_DIR for calls

This commit is contained in:
2025-10-07 14:54:09 +02:00
parent 6c7e7f496b
commit 420e50f23a
2 changed files with 3 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ object Main {
logger.debug(s"Subcommand requires ${tasks.size} tasks") logger.debug(s"Subcommand requires ${tasks.size} tasks")
try { try {
tasks.foreach(_.run()) tasks.foreach(_.run())
c.cleanup()
} catch { } catch {
case e: AssertException => case e: AssertException =>
logger.error(s"Error during task execution, see above!") logger.error(s"Error during task execution, see above!")
@@ -43,7 +44,6 @@ object Main {
logger.error(s"General exception ${e.getMessage}") logger.error(s"General exception ${e.getMessage}")
e.printStackTrace() e.printStackTrace()
} }
c.cleanup()
case _ => case _ =>
logger.error(s"Found no subcommand, see help below") logger.error(s"Found no subcommand, see help below")
conf.printHelp() conf.printHelp()

View File

@@ -1,5 +1,6 @@
package com.minres.tgc.hammer.tasks package com.minres.tgc.hammer.tasks
import com.minres.tgc.hammer.Global.TMP_DIR
import com.minres.tgc.hammer.Main import com.minres.tgc.hammer.Main
import com.minres.tgc.hammer.util.Logging import com.minres.tgc.hammer.util.Logging
import os.{Path, Shellable} import os.{Path, Shellable}
@@ -26,6 +27,6 @@ trait TaskImpl[T <: Task : ClassTag] extends Task with Logging[T] {
os.Inherit os.Inherit
else else
logFile logFile
os.proc("bash", "-c", command).call(stdout = output) os.proc("bash", "-c", command).call(cwd = TMP_DIR, stdout = output)
} }
} }