Skip to content

Commit 0188cc0

Browse files
author
Federico Fissore
committed
Extracting ExecRecipeSpecifyStdOutStdErr, parametric version of ExecRecipe
Signed-off-by: Federico Fissore <[email protected]>
1 parent 1b218d3 commit 0188cc0

File tree

1 file changed

+7
-2
lines changed
  • src/arduino.cc/builder/builder_utils

1 file changed

+7
-2
lines changed

Diff for: src/arduino.cc/builder/builder_utils/utils.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -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

280281
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) {
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

Comments
 (0)