@@ -35,6 +35,7 @@ import (
3535 "arduino.cc/builder/props"
3636 "arduino.cc/builder/utils"
3737 "fmt"
38+ "io"
3839 "os"
3940 "path/filepath"
4041 "strings"
@@ -278,6 +279,10 @@ func ArchiveCompiledFiles(buildPath string, archiveFile string, objectFiles []st
278279}
279280
280281func ExecRecipe (properties map [string ]string , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) ([]byte , error ) {
282+ return ExecRecipeSpecifyStdOutStdErr (properties , recipe , removeUnsetProperties , echoCommandLine , echoOutput , logger , os .Stdout , os .Stderr )
283+ }
284+
285+ func ExecRecipeSpecifyStdOutStdErr (properties map [string ]string , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger , stdout io.Writer , stderr io.Writer ) ([]byte , error ) {
281286 pattern := properties [recipe ]
282287 if pattern == constants .EMPTY_STRING {
283288 return nil , utils .ErrorfWithLogger (logger , constants .MSG_PATTERN_MISSING , recipe )
@@ -302,10 +307,10 @@ func ExecRecipe(properties map[string]string, recipe string, removeUnsetProperti
302307 }
303308
304309 if echoOutput {
305- command .Stdout = os . Stdout
310+ command .Stdout = stdout
306311 }
307312
308- command .Stderr = os . Stderr
313+ command .Stderr = stderr
309314
310315 if echoOutput {
311316 err := command .Run ()
0 commit comments