Skip to content

Instantly share code, notes, and snippets.

@mbroadhead
Created May 12, 2015 20:12
Show Gist options
  • Save mbroadhead/d9da0fd3c2b13ba5cf33 to your computer and use it in GitHub Desktop.
Save mbroadhead/d9da0fd3c2b13ba5cf33 to your computer and use it in GitHub Desktop.
Rex::Transaction never calls the rollback code.
use Rex -base;
use Rex::Transaction;
task "test" => sub {
# This never gets called because Rex::Transaction::transaction() empties out the @ROLLBACKS array
# see here:
# grep -A1 "Cleaning ROLLBACKS array" lib/Rex/Transaction.pm
#
on_rollback {
Rex::Logger::info("rolling back test task");
};
transaction {
say "command 1 success";
die "command 2 fail";
say "shouldn't get to command 3";
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment