From b623c6f8eb6573fe0ec0d1b8298425e2e4003eb5 Mon Sep 17 00:00:00 2001 From: Timo Klenk Date: Thu, 7 Apr 2022 11:02:33 +0200 Subject: [PATCH] Rename ctx argument --- pkg/ephemeral/fake_spdz_test.go | 4 ++-- pkg/utils/os.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/ephemeral/fake_spdz_test.go b/pkg/ephemeral/fake_spdz_test.go index 6763ae4c..678075c9 100644 --- a/pkg/ephemeral/fake_spdz_test.go +++ b/pkg/ephemeral/fake_spdz_test.go @@ -94,14 +94,14 @@ func (f *FakePlayer) PublishEvent(name, topic string, event *pb.Event) { type FakeExecutor struct { } -func (f *FakeExecutor) CallCMD(theContext context.Context, cmd []string, dir string) ([]byte, []byte, error) { +func (f *FakeExecutor) CallCMD(ctx context.Context, cmd []string, dir string) ([]byte, []byte, error) { return []byte{}, []byte{}, nil } type BrokenFakeExecutor struct { } -func (f *BrokenFakeExecutor) CallCMD(theContext context.Context, cmd []string, dir string) ([]byte, []byte, error) { +func (f *BrokenFakeExecutor) CallCMD(ctx context.Context, cmd []string, dir string) ([]byte, []byte, error) { return []byte{}, []byte{}, errors.New("some error") } diff --git a/pkg/utils/os.go b/pkg/utils/os.go index d2d5109d..cf09d7ec 100644 --- a/pkg/utils/os.go +++ b/pkg/utils/os.go @@ -21,7 +21,7 @@ import ( // Executor is an interface for calling a command and process its output. type Executor interface { // CallCMD executes the command and returns the output's STDOUT, STDERR streams as well as any errors - CallCMD(theContext context.Context, cmd []string, dir string) ([]byte, []byte, error) + CallCMD(ctx context.Context, cmd []string, dir string) ([]byte, []byte, error) } var ( @@ -56,10 +56,10 @@ func (c *Commander) Run(cmd string) ([]byte, []byte, error) { // ``` // If the command fails to run or doesn't complete successfully, the error is of type *ExitError. Other error types may be returned for I/O problems. // ``` -func (c *Commander) CallCMD(theContext context.Context, cmd []string, dir string) ([]byte, []byte, error) { +func (c *Commander) CallCMD(ctx context.Context, cmd []string, dir string) ([]byte, []byte, error) { baseCmd := c.Options baseCmd = append(baseCmd, cmd...) - command := exec.CommandContext(theContext, c.Command, baseCmd...) + command := exec.CommandContext(ctx, c.Command, baseCmd...) stderrBuffer := bytes.NewBuffer([]byte{}) stdoutBuffer := bytes.NewBuffer([]byte{}) command.Stderr = stderrBuffer