@@ -35,6 +35,7 @@ import (
35
35
"arduino.cc/builder/props"
36
36
"arduino.cc/builder/utils"
37
37
"fmt"
38
+ "io"
38
39
"os"
39
40
"path/filepath"
40
41
"strings"
@@ -278,6 +279,10 @@ func ArchiveCompiledFiles(buildPath string, archiveFile string, objectFiles []st
278
279
}
279
280
280
281
func 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 ) {
281
286
pattern := properties [recipe ]
282
287
if pattern == constants .EMPTY_STRING {
283
288
return nil , utils .ErrorfWithLogger (logger , constants .MSG_PATTERN_MISSING , recipe )
@@ -302,10 +307,10 @@ func ExecRecipe(properties map[string]string, recipe string, removeUnsetProperti
302
307
}
303
308
304
309
if echoOutput {
305
- command .Stdout = os . Stdout
310
+ command .Stdout = stdout
306
311
}
307
312
308
- command .Stderr = os . Stderr
313
+ command .Stderr = stderr
309
314
310
315
if echoOutput {
311
316
err := command .Run ()
0 commit comments