From c6350dbafc97ede14d7d1a42355088f6b87b78ad Mon Sep 17 00:00:00 2001 From: Luis Neves Date: Thu, 6 Feb 2020 03:50:13 +0000 Subject: [PATCH] Export used CommandExecutor for testing DI --- cmd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd.go b/cmd.go index 29bd9e2..9854c5b 100644 --- a/cmd.go +++ b/cmd.go @@ -289,6 +289,7 @@ func (c *Cmd) Done() <-chan struct{} { } // -------------------------------------------------------------------------- +var CommandExecutor = exec.Command func (c *Cmd) run() { defer func() { @@ -299,7 +300,7 @@ func (c *Cmd) run() { // ////////////////////////////////////////////////////////////////////// // Setup command // ////////////////////////////////////////////////////////////////////// - cmd := exec.Command(c.Name, c.Args...) + cmd := CommandExecutor(c.Name, c.Args...) // Platform-specific SysProcAttr management setProcessGroupID(cmd)