From c0d336ca456093b2b7c0b585dbe08f62cbc8ca83 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 22 Dec 2023 02:04:11 +0700 Subject: all: add [context.Context] to Local and Play Passing context allow the command Local or Play to be cancelled when running in asynchronous mode, in this case when awwan run with WUI. --- sudo_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sudo_test.go') diff --git a/sudo_test.go b/sudo_test.go index 2ad8be5..cf2de67 100644 --- a/sudo_test.go +++ b/sudo_test.go @@ -7,6 +7,7 @@ package awwan import ( "bytes" + "context" "testing" "github.com/shuLhan/share/lib/test" @@ -85,6 +86,8 @@ func TestExecLocal_sudo(t *testing.T) { }} var ( + ctx = context.Background() + c testCase stmt Statement x int @@ -98,7 +101,7 @@ func TestExecLocal_sudo(t *testing.T) { mockin.buf.WriteString(c.sudoPass) for x, stmt = range c.listStmt { - err = ExecLocal(req, &stmt) + err = ExecLocal(ctx, req, &stmt) if err != nil { t.Log(mockout.String()) var expError = c.expError[x] -- cgit v1.3