liquid_feedback_frontend
changeset 1220:af42478acf74
Avoid executing commands after error in lf4rcs.commit(...)
author | jbe |
---|---|
date | Tue Dec 01 02:10:04 2015 +0100 (2015-12-01) |
parents | 30523f31b186 |
children | e80c8790a1ca |
files | env/lf4rcs/commit.lua |
line diff
1.1 --- a/env/lf4rcs/commit.lua Mon Nov 30 19:40:38 2015 +0100 1.2 +++ b/env/lf4rcs/commit.lua Tue Dec 01 02:10:04 2015 +0100 1.3 @@ -7,17 +7,25 @@ 1.4 :add_where{ "issue_id = ?", issue.id } 1.5 :exec() 1.6 for i, initiative in ipairs(initiatives) do 1.7 + local failure = false 1.8 local function exec(...) 1.9 local command, output, err_message, exit_code = lf4rcs.exec(...) 1.10 - local log = "Executed: " .. command .. "\n" 1.11 - if output then 1.12 - log = log .. output .. "\n" 1.13 - end 1.14 - if err_message and #err_message > 0 then 1.15 - log = log .. "ERROR: " .. err_message .. "\n" 1.16 - end 1.17 - if exit_code and exit_code ~= 0 then 1.18 - log = log .. "Exit code: " .. tostring(exit_code) .. "\n" 1.19 + local log 1.20 + if failure then 1.21 + log = "Skipped: " .. command .. "\n" 1.22 + else 1.23 + log = "Executed: " .. command .. "\n" 1.24 + if output then 1.25 + log = log .. output .. "\n" 1.26 + end 1.27 + if err_message and #err_message > 0 then 1.28 + log = log .. "ERROR: " .. err_message .. "\n" 1.29 + failure = true 1.30 + end 1.31 + if exit_code and exit_code ~= 0 then 1.32 + log = log .. "Exit code: " .. tostring(exit_code) .. "\n" 1.33 + failure = true 1.34 + end 1.35 end 1.36 issue.admin_notice = (issue.admin_notice or "") .. log 1.37 issue:save()