Skip to content

Commit a596028

Browse files
committed
Output 'ctags' command line to stdout instead of stderr
1 parent f967107 commit a596028

File tree

1 file changed

+7
-8
lines changed
  • internal/arduino/builder/internal/preprocessor

1 file changed

+7
-8
lines changed

Diff for: internal/arduino/builder/internal/preprocessor/ctags.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ func PreprocessSketchWithCtags(
8383
}
8484

8585
// Run CTags on gcc-preprocessed source
86-
ctagsOutput, ctagsStdErr, err := RunCTags(ctx, ctagsTarget, buildProperties)
86+
ctagsOutput, ctagsStdErr, ctagsCmdLine, err := RunCTags(ctx, ctagsTarget, buildProperties)
8787
if verbose {
88+
stdout.Write([]byte(ctagsCmdLine + "\n"))
8889
stderr.Write(ctagsStdErr)
8990
}
9091
if err != nil {
@@ -178,7 +179,7 @@ func isFirstFunctionOutsideOfSource(firstFunctionLine int, sourceRows []string)
178179
}
179180

180181
// RunCTags performs a run of ctags on the given source file. Returns the ctags output and the stderr contents.
181-
func RunCTags(ctx context.Context, sourceFile *paths.Path, buildProperties *properties.Map) ([]byte, []byte, error) {
182+
func RunCTags(ctx context.Context, sourceFile *paths.Path, buildProperties *properties.Map) ([]byte, []byte, string, error) {
182183
ctagsBuildProperties := properties.NewMap()
183184
ctagsBuildProperties.Set("tools.ctags.path", "{runtime.tools.ctags.path}")
184185
ctagsBuildProperties.Set("tools.ctags.cmd.path", "{path}/ctags")
@@ -189,24 +190,22 @@ func RunCTags(ctx context.Context, sourceFile *paths.Path, buildProperties *prop
189190

190191
pattern := ctagsBuildProperties.Get("pattern")
191192
if pattern == "" {
192-
return nil, nil, errors.New(i18n.Tr("%s pattern is missing", "ctags"))
193+
return nil, nil, "", errors.New(i18n.Tr("%s pattern is missing", "ctags"))
193194
}
194195

195196
commandLine := ctagsBuildProperties.ExpandPropsInString(pattern)
196197
parts, err := properties.SplitQuotedString(commandLine, `"'`, false)
197198
if err != nil {
198-
return nil, nil, err
199+
return nil, nil, "", err
199200
}
200201
proc, err := paths.NewProcess(nil, parts...)
201202
if err != nil {
202-
return nil, nil, err
203+
return nil, nil, "", err
203204
}
204205
stdout, stderr, err := proc.RunAndCaptureOutput(ctx)
205206

206-
// Append ctags arguments to stderr
207207
args := fmt.Sprintln(strings.Join(parts, " "))
208-
stderr = append([]byte(args), stderr...)
209-
return stdout, stderr, err
208+
return stdout, stderr, args, err
210209
}
211210

212211
func filterSketchSource(sketch *sketch.Sketch, source io.Reader, removeLineMarkers bool) string {

0 commit comments

Comments
 (0)