Skip to content

Commit 24ac040

Browse files
committed
Pass down context in all places where it's needed
1 parent 240c8b3 commit 24ac040

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+161
-182
lines changed

commands/instances.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
251251
}
252252
} else {
253253
// Load platforms from profile
254-
errs := pmb.LoadHardwareForProfile(profile, true, downloadCallback, taskCallback, s.settings)
254+
errs := pmb.LoadHardwareForProfile(ctx, profile, true, downloadCallback, taskCallback, s.settings)
255255
for _, err := range errs {
256256
s := &cmderrors.PlatformLoadingError{Cause: err}
257257
responseError(s.GRPCStatus())
@@ -497,13 +497,11 @@ func (s *arduinoCoreServerImpl) UpdateLibrariesIndex(req *rpc.UpdateLibrariesInd
497497
}
498498

499499
// Perform index update
500-
// TODO: pass context
501-
// ctx := stream.Context()
502500
config, err := s.settings.DownloaderConfig()
503501
if err != nil {
504502
return err
505503
}
506-
if err := globals.LibrariesIndexResource.Download(indexDir, downloadCB, config); err != nil {
504+
if err := globals.LibrariesIndexResource.Download(stream.Context(), indexDir, downloadCB, config); err != nil {
507505
resultCB(rpc.IndexUpdateReport_STATUS_FAILED)
508506
return err
509507
}
@@ -621,7 +619,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
621619
indexResource.SignatureURL, _ = url.Parse(u) // should not fail because we already parsed it
622620
indexResource.SignatureURL.Path += ".sig"
623621
}
624-
if err := indexResource.Download(indexpath, downloadCB, config); err != nil {
622+
if err := indexResource.Download(stream.Context(), indexpath, downloadCB, config); err != nil {
625623
failed = true
626624
result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_FAILED))
627625
} else {

internal/arduino/builder/builder.go

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ var ErrSketchCannotBeLocatedInBuildPath = errors.New("sketch cannot be located i
4444

4545
// Builder is a Sketch builder.
4646
type Builder struct {
47+
ctx context.Context
48+
4749
sketch *sketch.Sketch
4850
buildProperties *properties.Map
4951

@@ -198,6 +200,7 @@ func NewBuilder(
198200

199201
diagnosticStore := diagnostics.NewStore()
200202
b := &Builder{
203+
ctx: ctx,
201204
sketch: sk,
202205
buildProperties: buildProperties,
203206
buildPath: buildPath,
@@ -305,6 +308,7 @@ func (b *Builder) preprocess() error {
305308

306309
b.logIfVerbose(false, tr("Detecting libraries used..."))
307310
err := b.libsDetector.FindIncludes(
311+
b.ctx,
308312
b.buildPath,
309313
b.buildProperties.GetPath("build.core.path"),
310314
b.buildProperties.GetPath("build.variant.path"),

internal/arduino/builder/internal/detector/detector.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package detector
1717

1818
import (
1919
"bytes"
20+
"context"
2021
"encoding/json"
2122
"errors"
2223
"fmt"
@@ -196,6 +197,7 @@ func (l *SketchLibrariesDetector) appendIncludeFolder(
196197

197198
// FindIncludes todo
198199
func (l *SketchLibrariesDetector) FindIncludes(
200+
ctx context.Context,
199201
buildPath *paths.Path,
200202
buildCorePath *paths.Path,
201203
buildVariantPath *paths.Path,
@@ -205,7 +207,7 @@ func (l *SketchLibrariesDetector) FindIncludes(
205207
buildProperties *properties.Map,
206208
platformArch string,
207209
) error {
208-
err := l.findIncludes(buildPath, buildCorePath, buildVariantPath, sketchBuildPath, sketch, librariesBuildPath, buildProperties, platformArch)
210+
err := l.findIncludes(ctx, buildPath, buildCorePath, buildVariantPath, sketchBuildPath, sketch, librariesBuildPath, buildProperties, platformArch)
209211
if err != nil && l.onlyUpdateCompilationDatabase {
210212
l.logger.Info(
211213
fmt.Sprintf(
@@ -220,6 +222,7 @@ func (l *SketchLibrariesDetector) FindIncludes(
220222
}
221223

222224
func (l *SketchLibrariesDetector) findIncludes(
225+
ctx context.Context,
223226
buildPath *paths.Path,
224227
buildCorePath *paths.Path,
225228
buildVariantPath *paths.Path,
@@ -269,7 +272,7 @@ func (l *SketchLibrariesDetector) findIncludes(
269272
}
270273

271274
for !sourceFileQueue.empty() {
272-
err := l.findIncludesUntilDone(cache, sourceFileQueue, buildProperties, sketchBuildPath, librariesBuildPath, platformArch)
275+
err := l.findIncludesUntilDone(ctx, cache, sourceFileQueue, buildProperties, sketchBuildPath, librariesBuildPath, platformArch)
273276
if err != nil {
274277
cachePath.Remove()
275278
return err
@@ -297,6 +300,7 @@ func (l *SketchLibrariesDetector) findIncludes(
297300
}
298301

299302
func (l *SketchLibrariesDetector) findIncludesUntilDone(
303+
ctx context.Context,
300304
cache *includeCache,
301305
sourceFileQueue *uniqueSourceFileQueue,
302306
buildProperties *properties.Map,
@@ -350,7 +354,7 @@ func (l *SketchLibrariesDetector) findIncludesUntilDone(
350354
l.logger.Info(tr("Using cached library dependencies for file: %[1]s", sourcePath))
351355
}
352356
} else {
353-
preprocFirstResult, preprocErr = preprocessor.GCC(sourcePath, targetFilePath, includeFolders, buildProperties)
357+
preprocFirstResult, preprocErr = preprocessor.GCC(ctx, sourcePath, targetFilePath, includeFolders, buildProperties)
354358
if l.logger.Verbose() {
355359
l.logger.WriteStdout(preprocFirstResult.Stdout())
356360
}
@@ -381,7 +385,7 @@ func (l *SketchLibrariesDetector) findIncludesUntilDone(
381385
// Library could not be resolved, show error
382386
if preprocErr == nil || preprocFirstResult.Stderr() == nil {
383387
// Filename came from cache, so run preprocessor to obtain error to show
384-
result, err := preprocessor.GCC(sourcePath, targetFilePath, includeFolders, buildProperties)
388+
result, err := preprocessor.GCC(ctx, sourcePath, targetFilePath, includeFolders, buildProperties)
385389
if l.logger.Verbose() {
386390
l.logger.WriteStdout(result.Stdout())
387391
}

internal/arduino/builder/internal/preprocessor/arduino_preprocessor.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
// PreprocessSketchWithArduinoPreprocessor performs preprocessing of the arduino sketch
3232
// using arduino-preprocessor (https://github.com/arduino/arduino-preprocessor).
3333
func PreprocessSketchWithArduinoPreprocessor(
34+
ctx context.Context,
3435
sk *sketch.Sketch, buildPath *paths.Path, includeFolders paths.PathList,
3536
lineOffset int, buildProperties *properties.Map, onlyUpdateCompilationDatabase bool,
3637
) (*Result, error) {
@@ -42,7 +43,7 @@ func PreprocessSketchWithArduinoPreprocessor(
4243

4344
sourceFile := buildPath.Join("sketch", sk.MainFile.Base()+".cpp")
4445
targetFile := buildPath.Join("preproc", "sketch_merged.cpp")
45-
gccResult, err := GCC(sourceFile, targetFile, includeFolders, buildProperties)
46+
gccResult, err := GCC(ctx, sourceFile, targetFile, includeFolders, buildProperties)
4647
verboseOut.Write(gccResult.Stdout())
4748
verboseOut.Write(gccResult.Stderr())
4849
if err != nil {
@@ -78,7 +79,7 @@ func PreprocessSketchWithArduinoPreprocessor(
7879
}
7980

8081
verboseOut.WriteString(commandLine)
81-
commandStdOut, commandStdErr, err := command.RunAndCaptureOutput(context.Background())
82+
commandStdOut, commandStdErr, err := command.RunAndCaptureOutput(ctx)
8283
verboseOut.Write(commandStdErr)
8384
if err != nil {
8485
return &Result{args: gccResult.Args(), stdout: verboseOut.Bytes(), stderr: normalOut.Bytes()}, err

internal/arduino/builder/internal/preprocessor/ctags.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var DebugPreprocessor bool
4141

4242
// PreprocessSketchWithCtags performs preprocessing of the arduino sketch using CTags.
4343
func PreprocessSketchWithCtags(
44+
ctx context.Context,
4445
sketch *sketch.Sketch, buildPath *paths.Path, includes paths.PathList,
4546
lineOffset int, buildProperties *properties.Map,
4647
onlyUpdateCompilationDatabase, verbose bool,
@@ -57,7 +58,7 @@ func PreprocessSketchWithCtags(
5758

5859
// Run GCC preprocessor
5960
sourceFile := buildPath.Join("sketch", sketch.MainFile.Base()+".cpp")
60-
result, err := GCC(sourceFile, ctagsTarget, includes, buildProperties)
61+
result, err := GCC(ctx, sourceFile, ctagsTarget, includes, buildProperties)
6162
stdout.Write(result.Stdout())
6263
stderr.Write(result.Stderr())
6364
if err != nil {
@@ -84,7 +85,7 @@ func PreprocessSketchWithCtags(
8485
}
8586

8687
// Run CTags on gcc-preprocessed source
87-
ctagsOutput, ctagsStdErr, err := RunCTags(ctagsTarget, buildProperties)
88+
ctagsOutput, ctagsStdErr, err := RunCTags(ctx, ctagsTarget, buildProperties)
8889
if verbose {
8990
stderr.Write(ctagsStdErr)
9091
}
@@ -179,7 +180,7 @@ func isFirstFunctionOutsideOfSource(firstFunctionLine int, sourceRows []string)
179180
}
180181

181182
// RunCTags performs a run of ctags on the given source file. Returns the ctags output and the stderr contents.
182-
func RunCTags(sourceFile *paths.Path, buildProperties *properties.Map) ([]byte, []byte, error) {
183+
func RunCTags(ctx context.Context, sourceFile *paths.Path, buildProperties *properties.Map) ([]byte, []byte, error) {
183184
ctagsBuildProperties := properties.NewMap()
184185
ctagsBuildProperties.Set("tools.ctags.path", "{runtime.tools.ctags.path}")
185186
ctagsBuildProperties.Set("tools.ctags.cmd.path", "{path}/ctags")
@@ -202,7 +203,7 @@ func RunCTags(sourceFile *paths.Path, buildProperties *properties.Map) ([]byte,
202203
if err != nil {
203204
return nil, nil, err
204205
}
205-
stdout, stderr, err := proc.RunAndCaptureOutput(context.Background())
206+
stdout, stderr, err := proc.RunAndCaptureOutput(ctx)
206207

207208
// Append ctags arguments to stderr
208209
args := fmt.Sprintln(strings.Join(parts, " "))

internal/arduino/builder/internal/preprocessor/gcc.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
// GCC performs a run of the gcc preprocess (macro/includes expansion). The function outputs the result
3131
// to targetFilePath. Returns the stdout/stderr of gcc if any.
3232
func GCC(
33+
ctx context.Context,
3334
sourceFilePath, targetFilePath *paths.Path,
3435
includes paths.PathList, buildProperties *properties.Map,
3536
) (Result, error) {
@@ -75,7 +76,7 @@ func GCC(
7576
if err != nil {
7677
return Result{}, err
7778
}
78-
stdout, stderr, err := proc.RunAndCaptureOutput(context.Background())
79+
stdout, stderr, err := proc.RunAndCaptureOutput(ctx)
7980

8081
// Append gcc arguments to stdout
8182
stdout = append([]byte(fmt.Sprintln(strings.Join(args, " "))), stdout...)

internal/arduino/builder/preprocess_sketch.go

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
func (b *Builder) preprocessSketch(includes paths.PathList) error {
2525
// In the future we might change the preprocessor
2626
result, err := preprocessor.PreprocessSketchWithCtags(
27+
b.ctx,
2728
b.sketch, b.buildPath, includes, b.lineOffset,
2829
b.buildProperties, b.onlyUpdateCompilationDatabase, b.logger.Verbose(),
2930
)

internal/arduino/cores/packagemanager/profiles.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package packagemanager
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"net/url"
2122

@@ -32,15 +33,15 @@ import (
3233

3334
// LoadHardwareForProfile load the hardware platforms for the given profile.
3435
// If installMissing is true then possibly missing tools and platforms will be downloaded and installed.
35-
func (pmb *Builder) LoadHardwareForProfile(p *sketch.Profile, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) []error {
36+
func (pmb *Builder) LoadHardwareForProfile(ctx context.Context, p *sketch.Profile, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) []error {
3637
pmb.profile = p
3738

3839
// Load required platforms
3940
var merr []error
4041
var platformReleases []*cores.PlatformRelease
4142
indexURLs := map[string]*url.URL{}
4243
for _, platformRef := range p.Platforms {
43-
if platformRelease, err := pmb.loadProfilePlatform(platformRef, installMissing, downloadCB, taskCB, settings); err != nil {
44+
if platformRelease, err := pmb.loadProfilePlatform(ctx, platformRef, installMissing, downloadCB, taskCB, settings); err != nil {
4445
merr = append(merr, fmt.Errorf("%s: %w", tr("loading required platform %s", platformRef), err))
4546
logrus.WithField("platform", platformRef).WithError(err).Debugf("Error loading platform for profile")
4647
} else {
@@ -68,7 +69,7 @@ func (pmb *Builder) LoadHardwareForProfile(p *sketch.Profile, installMissing boo
6869
return merr
6970
}
7071

71-
func (pmb *Builder) loadProfilePlatform(platformRef *sketch.ProfilePlatformReference, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) (*cores.PlatformRelease, error) {
72+
func (pmb *Builder) loadProfilePlatform(ctx context.Context, platformRef *sketch.ProfilePlatformReference, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) (*cores.PlatformRelease, error) {
7273
targetPackage := pmb.packages.GetOrCreatePackage(platformRef.Packager)
7374
platform := targetPackage.GetOrCreatePlatform(platformRef.Architecture)
7475
release := platform.GetOrCreateRelease(platformRef.Version)
@@ -77,14 +78,14 @@ func (pmb *Builder) loadProfilePlatform(platformRef *sketch.ProfilePlatformRefer
7778
destDir := settings.ProfilesCacheDir().Join(uid)
7879
if !destDir.IsDir() && installMissing {
7980
// Try installing the missing platform
80-
if err := pmb.installMissingProfilePlatform(platformRef, destDir, downloadCB, taskCB); err != nil {
81+
if err := pmb.installMissingProfilePlatform(ctx, platformRef, destDir, downloadCB, taskCB); err != nil {
8182
return nil, err
8283
}
8384
}
8485
return release, pmb.loadPlatformRelease(release, destDir)
8586
}
8687

87-
func (pmb *Builder) installMissingProfilePlatform(platformRef *sketch.ProfilePlatformReference, destDir *paths.Path, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error {
88+
func (pmb *Builder) installMissingProfilePlatform(ctx context.Context, platformRef *sketch.ProfilePlatformReference, destDir *paths.Path, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error {
8889
// Instantiate a temporary package manager only for platform installation
8990
_ = pmb.tempDir.MkdirAll()
9091
tmp, err := paths.MkTempDir(pmb.tempDir.String(), "")
@@ -103,7 +104,7 @@ func (pmb *Builder) installMissingProfilePlatform(platformRef *sketch.ProfilePla
103104
}
104105
for _, indexURL := range indexesToDownload {
105106
indexResource := resources.IndexResource{URL: indexURL}
106-
if err := indexResource.Download(tmpPmb.IndexDir, downloadCB, pmb.downloaderConfig); err != nil {
107+
if err := indexResource.Download(ctx, tmpPmb.IndexDir, downloadCB, pmb.downloaderConfig); err != nil {
107108
taskCB(&rpc.TaskProgress{Name: tr("Error downloading %s", indexURL)})
108109
return &cmderrors.FailedDownloadError{Message: tr("Error downloading %s", indexURL), Cause: err}
109110
}

internal/arduino/resources/index.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (res *IndexResource) IndexFileName() (string, error) {
5858

5959
// Download will download the index and possibly check the signature using the Arduino's public key.
6060
// If the file is in .gz format it will be unpacked first.
61-
func (res *IndexResource) Download(destDir *paths.Path, downloadCB rpc.DownloadProgressCB, config downloader.Config) error {
61+
func (res *IndexResource) Download(ctx context.Context, destDir *paths.Path, downloadCB rpc.DownloadProgressCB, config downloader.Config) error {
6262
// Create destination directory
6363
if err := destDir.MkdirAll(); err != nil {
6464
return &cmderrors.PermissionDeniedError{Message: tr("Can't create data directory %s", destDir), Cause: err}
@@ -100,7 +100,7 @@ func (res *IndexResource) Download(destDir *paths.Path, downloadCB rpc.DownloadP
100100
defer f.Close()
101101
tmpArchivePath := tmp.Join("archive")
102102
_ = tmpArchivePath.MkdirAll()
103-
if err := extract.Bz2(context.Background(), f, tmpArchivePath.String(), nil); err != nil {
103+
if err := extract.Bz2(ctx, f, tmpArchivePath.String(), nil); err != nil {
104104
return &cmderrors.PermissionDeniedError{Message: tr("Error extracting %s", tmpIndexPath), Cause: err}
105105
}
106106

internal/arduino/resources/resources_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package resources
1717

1818
import (
19+
"context"
1920
"crypto"
2021
"encoding/hex"
2122
"fmt"
@@ -116,6 +117,7 @@ func TestDownloadAndChecksums(t *testing.T) {
116117
}
117118

118119
func TestIndexDownloadAndSignatureWithinArchive(t *testing.T) {
120+
ctx := context.Background()
119121
// Spawn test webserver
120122
mux := http.NewServeMux()
121123
fs := http.FileServer(http.Dir("testdata"))
@@ -132,7 +134,7 @@ func TestIndexDownloadAndSignatureWithinArchive(t *testing.T) {
132134
destDir, err := paths.MkTempDir("", "")
133135
require.NoError(t, err)
134136
defer destDir.RemoveAll()
135-
err = idxResource.Download(destDir, func(curr *rpc.DownloadProgress) {}, downloader.GetDefaultConfig())
137+
err = idxResource.Download(ctx, destDir, func(curr *rpc.DownloadProgress) {}, downloader.GetDefaultConfig())
136138
require.NoError(t, err)
137139
require.True(t, destDir.Join("package_index.json").Exist())
138140
require.True(t, destDir.Join("package_index.json.sig").Exist())
@@ -143,7 +145,7 @@ func TestIndexDownloadAndSignatureWithinArchive(t *testing.T) {
143145
invDestDir, err := paths.MkTempDir("", "")
144146
require.NoError(t, err)
145147
defer invDestDir.RemoveAll()
146-
err = invIdxResource.Download(invDestDir, func(curr *rpc.DownloadProgress) {}, downloader.GetDefaultConfig())
148+
err = invIdxResource.Download(ctx, invDestDir, func(curr *rpc.DownloadProgress) {}, downloader.GetDefaultConfig())
147149
require.Error(t, err)
148150
require.Contains(t, err.Error(), "invalid signature")
149151
require.False(t, invDestDir.Join("package_index.json").Exist())

internal/cli/arguments/completion.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
func GetInstalledBoards(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
3030
inst := instance.CreateAndInit(ctx, srv)
3131

32-
list, _ := srv.BoardListAll(context.Background(), &rpc.BoardListAllRequest{
32+
list, _ := srv.BoardListAll(ctx, &rpc.BoardListAllRequest{
3333
Instance: inst,
3434
SearchArgs: nil,
3535
IncludeHiddenBoards: false,
@@ -53,7 +53,7 @@ func GetInstalledProgrammers(ctx context.Context, srv rpc.ArduinoCoreServiceServ
5353
SearchArgs: nil,
5454
IncludeHiddenBoards: false,
5555
}
56-
list, _ := srv.BoardListAll(context.Background(), listAllReq)
56+
list, _ := srv.BoardListAll(ctx, listAllReq)
5757

5858
installedProgrammers := make(map[string]string)
5959
for _, board := range list.GetBoards() {
@@ -149,7 +149,7 @@ func getLibraries(ctx context.Context, srv rpc.ArduinoCoreServiceServer, all boo
149149
func GetInstallableLibs(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
150150
inst := instance.CreateAndInit(ctx, srv)
151151

152-
libs, _ := srv.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{
152+
libs, _ := srv.LibrarySearch(ctx, &rpc.LibrarySearchRequest{
153153
Instance: inst,
154154
SearchArgs: "", // if no query is specified all the libs are returned
155155
})

internal/cli/arguments/fqbn.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type Fqbn struct {
3737
func (f *Fqbn) AddToCommand(cmd *cobra.Command, srv rpc.ArduinoCoreServiceServer) {
3838
cmd.Flags().StringVarP(&f.fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno"))
3939
cmd.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
40-
return GetInstalledBoards(context.Background(), srv), cobra.ShellCompDirectiveDefault
40+
return GetInstalledBoards(cmd.Context(), srv), cobra.ShellCompDirectiveDefault
4141
})
4242
cmd.Flags().StringSliceVar(&f.boardOptions, "board-options", []string{},
4343
tr("List of board options separated by commas. Or can be used multiple times for multiple options."))
@@ -70,7 +70,7 @@ func (f *Fqbn) Set(fqbn string) {
7070
// - the port is not found, in this case nil is returned
7171
// - the FQBN autodetection fail, in this case the function prints an error and
7272
// terminates the execution
73-
func CalculateFQBNAndPort(portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, srv rpc.ArduinoCoreServiceServer, defaultFQBN, defaultAddress, defaultProtocol string) (string, *rpc.Port) {
73+
func CalculateFQBNAndPort(ctx context.Context, portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, srv rpc.ArduinoCoreServiceServer, defaultFQBN, defaultAddress, defaultProtocol string) (string, *rpc.Port) {
7474
fqbn := fqbnArg.String()
7575
if fqbn == "" {
7676
fqbn = defaultFQBN
@@ -79,14 +79,14 @@ func CalculateFQBNAndPort(portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance,
7979
if portArgs == nil || portArgs.address == "" {
8080
feedback.FatalError(&cmderrors.MissingFQBNError{}, feedback.ErrGeneric)
8181
}
82-
fqbn, port := portArgs.DetectFQBN(instance, srv)
82+
fqbn, port := portArgs.DetectFQBN(ctx, instance, srv)
8383
if fqbn == "" {
8484
feedback.FatalError(&cmderrors.MissingFQBNError{}, feedback.ErrGeneric)
8585
}
8686
return fqbn, port
8787
}
8888

89-
port, err := portArgs.GetPort(instance, srv, defaultAddress, defaultProtocol)
89+
port, err := portArgs.GetPort(ctx, instance, srv, defaultAddress, defaultProtocol)
9090
if err != nil {
9191
feedback.Fatal(tr("Error getting port metadata: %v", err), feedback.ErrGeneric)
9292
}

0 commit comments

Comments
 (0)