Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-20 07:30:11 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-20 07:32:40 +0300
commit26e749846cf21bd687e3a38f7584574b7b2247c3 (patch)
tree8302cc9f6ac8322099b2f104459dcec3154a94bb
parentaf3ad6db5905137174c6dfb592be4e33d76b27a6 (diff)
command: Remove useless check for whether the process is set
After starting an `exec.Cmd` the `Process` field is always set according to the documentation of it. Given that we only ever access that field after we have started the command already it's thus not needed to check whether the field is set or not. Remove the check to clean up the code.
-rw-r--r--internal/command/command.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/command/command.go b/internal/command/command.go
index f62fd46f4..2881cf86f 100644
--- a/internal/command/command.go
+++ b/internal/command/command.go
@@ -284,10 +284,10 @@ func New(ctx context.Context, nameAndArgs []string, opts ...Option) (*Command, e
// If the context has been cancelled and we didn't explicitly reap
// the child process then we need to manually kill it and release
// all associated resources.
- if process := cmd.Process; process != nil && process.Pid > 0 {
+ if cmd.Process.Pid > 0 {
//nolint:errcheck // TODO: do we want to report errors?
// Send SIGTERM to the process group of cmd
- syscall.Kill(-process.Pid, syscall.SIGTERM)
+ syscall.Kill(-cmd.Process.Pid, syscall.SIGTERM)
}
// We do not care for any potential error code, but just want to