# HG changeset patch # User jbe # Date 1448932204 -3600 # Node ID af42478acf74593e58644af36515415e67d26209 # Parent 30523f31b186248fe7eb8e6efd612ebdf19d818b Avoid executing commands after error in lf4rcs.commit(...) diff -r 30523f31b186 -r af42478acf74 env/lf4rcs/commit.lua --- a/env/lf4rcs/commit.lua Mon Nov 30 19:40:38 2015 +0100 +++ b/env/lf4rcs/commit.lua Tue Dec 01 02:10:04 2015 +0100 @@ -7,17 +7,25 @@ :add_where{ "issue_id = ?", issue.id } :exec() for i, initiative in ipairs(initiatives) do + local failure = false local function exec(...) local command, output, err_message, exit_code = lf4rcs.exec(...) - local log = "Executed: " .. command .. "\n" - if output then - log = log .. output .. "\n" - end - if err_message and #err_message > 0 then - log = log .. "ERROR: " .. err_message .. "\n" - end - if exit_code and exit_code ~= 0 then - log = log .. "Exit code: " .. tostring(exit_code) .. "\n" + local log + if failure then + log = "Skipped: " .. command .. "\n" + else + log = "Executed: " .. command .. "\n" + if output then + log = log .. output .. "\n" + end + if err_message and #err_message > 0 then + log = log .. "ERROR: " .. err_message .. "\n" + failure = true + end + if exit_code and exit_code ~= 0 then + log = log .. "Exit code: " .. tostring(exit_code) .. "\n" + failure = true + end end issue.admin_notice = (issue.admin_notice or "") .. log issue:save()