module Comandante::Cleaner
Extended modules
Comandante::Cleaner
Class methods
.debug=(debug)
Debug Mode, you can use an action to set this with a global --debug option
.exit_on_pipe_error=(exit_on_pipe_error)
Exit on pipe error, sometimes you to exit on pipe errors
Methods
#cleanup : Nil
Runs cleanup manually before end of block or from outside it. will run user cleanup procs first, then remove any tempfiles or tempdirs.
#exit_failure(msg : String, status = 1) : Nil
Will exit or raise exception with a message in accordance with
failure_behavior
. Will run cleanup first.
#exit_success(msg : String = "", status = 0) : Nil
Will exit with a message. Will run cleanup first.
#register(proc : SimpleProc) : Nil
Register a cleanup proc to be executed on exit from Cleanup::run block.
Example:
register ->{ my_cleaner; puts "cleanup done!" }
#run : Nil
Runs a block with cleanup afterwards.
You should wrap your app.run
inside
Examples:
Cleaner.run do
app.run
end
Will capture exceptions and run user cleanup function at end of block.
#tempdir(name = File.tempname) : Dir
Create a tempdir that will be removed on exit as long as you are
running inside a run
block
#tempdir(name = File.tempname, &) : Nil
Create a tempdir that will be removed on exit from block
#tempfile : File
Create a tempfile that will be removed on exit as long as you are
running inside a run
block