Skip to content

Commit

Permalink
Rename ctx argument
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Klenk <[email protected]>
  • Loading branch information
kindlich committed Apr 11, 2022
1 parent 86425bc commit a5309e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/ephemeral/fake_spdz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a5309e8

Please sign in to comment.