From 8d47e05fc74c4dcddc66697e3b1cb968cbd74c1f Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Fri, 2 Sep 2022 12:01:55 +0300 Subject: [PATCH] fix: test failure when sh is bash `echo` is a shell built-in and behaves differently on bash and dash. The test currently passes with dash but fails with bash. Let's use dash explicitly here. Log: Fix test failure when sh is bash --- shell/shell_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/shell_test.go b/shell/shell_test.go index 42f29b2d..0d571cb5 100644 --- a/shell/shell_test.go +++ b/shell/shell_test.go @@ -6,9 +6,9 @@ import ( ) func TestEncode(t *testing.T) { - _, err := exec.LookPath("sh") + _, err := exec.LookPath("dash") if err != nil { - t.Skip("not found sh") + t.Skip("dash not found") } for _, s := range []string{ @@ -21,7 +21,7 @@ func TestEncode(t *testing.T) { r := Encode(s) t.Log(r) - cmd := exec.Command("sh", "-c", "echo -n "+r) + cmd := exec.Command("dash", "-c", "echo -n "+r) output, err := cmd.Output() if err != nil { t.Fatal(err)