Cleanup tmp directory after build

This commit is contained in:
Roberto Alsina 2024-07-08 15:18:06 -03:00
parent 0358744b46
commit a2d65d4b5e
3 changed files with 5 additions and 3 deletions

View File

@ -32,7 +32,7 @@
* Implement `faaso help command` * Implement `faaso help command`
* ✅ Fix `export examples/hello_crystal` it has a `template/` * ✅ Fix `export examples/hello_crystal` it has a `template/`
* ✅ Implement zero-downtime rollout (`faaso deploy`) * ✅ Implement zero-downtime rollout (`faaso deploy`)
* Cleanup `tmp/` after use unless `DEBUG` is set * Cleanup `tmp/whatever` after use
* `faaso scale` remote is broken * `faaso scale` remote is broken
# Things to do but not before release # Things to do but not before release

View File

@ -16,6 +16,7 @@ module Faaso
if options["--local"] if options["--local"]
Log.info { "Building function... #{funko.name} in #{tmp_dir}" } Log.info { "Building function... #{funko.name} in #{tmp_dir}" }
funko.build tmp_dir funko.build tmp_dir
FileUtils.rm_rf(tmp_dir)
next next
end end
Faaso.check_version Faaso.check_version
@ -39,7 +40,7 @@ module Faaso
end end
end end
end end
FileUtils.rm_rf(tmp_dir)
tmp = File.tempname tmp = File.tempname
File.open(tmp, "w") do |outf| File.open(tmp, "w") do |outf|
outf << buf outf << buf

View File

@ -53,8 +53,9 @@ module Funko
# Build the thing # Build the thing
run_faaso(["build", tmp_dir.to_s, "--no-runtime"], env) run_faaso(["build", tmp_dir.to_s, "--no-runtime"], env)
ensure
FileUtils.rm_rf(tmp_dir) unless tmp_dir.nil?
end end
# Endpoints for the web frontend # Endpoints for the web frontend
# General status for the front page # General status for the front page