From 60c5339042a605076482320313e8f9498dd72af9 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 30 Nov 2019 08:40:22 -0600 Subject: Graceful: Cancel Process on monitor pages & HammerTime (#9213) * Graceful: Create callbacks to with contexts * Graceful: Say when Gitea is completely finished * Graceful: Git and Process within HammerTime Force all git commands to terminate at HammerTime Force all process commands to terminate at HammerTime Move almost all git processes to run as git Commands * Graceful: Always Hammer after Shutdown * ProcessManager: Add cancel functionality * Fix tests * Make sure that process.Manager.Kill() cancels * Make threadsafe access to Processes and remove own unused Kill * Remove cmd from the process manager as it is no longer used * the default context is the correct context * get rid of double till --- services/release/release.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'services/release/release.go') diff --git a/services/release/release.go b/services/release/release.go index 2f70bbb665..fd0c410e7c 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -13,7 +13,6 @@ import ( "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification" - "code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/timeutil" ) @@ -128,11 +127,11 @@ func DeleteReleaseByID(id int64, doer *models.User, delTag bool) error { } if delTag { - _, stderr, err := process.GetManager().ExecDir(-1, repo.RepoPath(), - fmt.Sprintf("DeleteReleaseByID (git tag -d): %d", rel.ID), - git.GitExecutable, "tag", "-d", rel.TagName) - if err != nil && !strings.Contains(stderr, "not found") { - return fmt.Errorf("git tag -d: %v - %s", err, stderr) + if stdout, err := git.NewCommand("tag", "-d", rel.TagName). + SetDescription(fmt.Sprintf("DeleteReleaseByID (git tag -d): %d", rel.ID)). + RunInDir(repo.RepoPath()); err != nil && !strings.Contains(err.Error(), "not found") { + log.Error("DeleteReleaseByID (git tag -d): %d in %v Failed:\nStdout: %s\nError: %v", rel.ID, repo, stdout, err) + return fmt.Errorf("git tag -d: %v", err) } if err := models.DeleteReleaseByID(id); err != nil { -- cgit v1.2.3