summaryrefslogtreecommitdiffstats
path: root/cmd/restore_repo.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-07-14 15:43:13 +0100
committerGitHub <noreply@github.com>2021-07-14 10:43:13 -0400
commit3dcb3e9073d825a4ada184f832892cf4bd5836a3 (patch)
treeaab77b7726f0e20f34b452df166113950ff5fc62 /cmd/restore_repo.go
parentee43d70a0c237ef9c02b99b9b49d1af348840319 (diff)
downloadgitea-3dcb3e9073d825a4ada184f832892cf4bd5836a3.tar.gz
gitea-3dcb3e9073d825a4ada184f832892cf4bd5836a3.zip
Second attempt at preventing zombies (#16326)
* Second attempt at preventing zombies * Ensure that the pipes are closed in ssh.go * Ensure that a cancellable context is passed up in cmd/* http requests * Make cmd.fail return properly so defers are obeyed * Ensure that something is sent to stdout in case of blocks here Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint 2 Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint 3 Signed-off-by: Andrew Thornton <art27@cantab.net> * fixup Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'cmd/restore_repo.go')
-rw-r--r--cmd/restore_repo.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd/restore_repo.go b/cmd/restore_repo.go
index b832471928..1208796c9b 100644
--- a/cmd/restore_repo.go
+++ b/cmd/restore_repo.go
@@ -40,20 +40,24 @@ var CmdRestoreRepository = cli.Command{
cli.StringFlag{
Name: "units",
Value: "",
- Usage: `Which items will be restored, one or more units should be separated as comma.
+ Usage: `Which items will be restored, one or more units should be separated as comma.
wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`,
},
},
}
-func runRestoreRepository(ctx *cli.Context) error {
+func runRestoreRepository(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setting.NewContext()
statusCode, errStr := private.RestoreRepo(
- ctx.String("repo_dir"),
- ctx.String("owner_name"),
- ctx.String("repo_name"),
- ctx.StringSlice("units"),
+ ctx,
+ c.String("repo_dir"),
+ c.String("owner_name"),
+ c.String("repo_name"),
+ c.StringSlice("units"),
)
if statusCode == http.StatusOK {
return nil