diff options
Diffstat (limited to 'pkg/commands/oscommands')
-rw-r--r-- | pkg/commands/oscommands/os.go | 3 | ||||
-rw-r--r-- | pkg/commands/oscommands/os_test.go | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index bbfcb8095..2638f3c49 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -16,6 +16,7 @@ import ( "github.com/atotto/clipboard" "github.com/jesseduffield/lazygit/pkg/config" + "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/mgutz/str" "github.com/sirupsen/logrus" @@ -49,7 +50,7 @@ func NewOSCommand(log *logrus.Entry, config config.AppConfigurer) *OSCommand { Log: log, Platform: getPlatform(), Config: config, - Command: exec.Command, + Command: secureexec.Command, BeforeExecuteCmd: func(*exec.Cmd) {}, Getenv: os.Getenv, } diff --git a/pkg/commands/oscommands/os_test.go b/pkg/commands/oscommands/os_test.go index f8b3767bf..1504e4322 100644 --- a/pkg/commands/oscommands/os_test.go +++ b/pkg/commands/oscommands/os_test.go @@ -6,6 +6,7 @@ import ( "os/exec" "testing" + "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/stretchr/testify/assert" ) @@ -70,7 +71,7 @@ func TestOSCommandOpenFile(t *testing.T) { { "test", func(name string, arg ...string) *exec.Cmd { - return exec.Command("exit", "1") + return secureexec.Command("exit", "1") }, func(err error) { assert.Error(t, err) @@ -81,7 +82,7 @@ func TestOSCommandOpenFile(t *testing.T) { func(name string, arg ...string) *exec.Cmd { assert.Equal(t, "open", name) assert.Equal(t, []string{"test"}, arg) - return exec.Command("echo") + return secureexec.Command("echo") }, func(err error) { assert.NoError(t, err) @@ -92,7 +93,7 @@ func TestOSCommandOpenFile(t *testing.T) { func(name string, arg ...string) *exec.Cmd { assert.Equal(t, "open", name) assert.Equal(t, []string{"filename with spaces"}, arg) - return exec.Command("echo") + return secureexec.Command("echo") }, func(err error) { assert.NoError(t, err) |