Skip to content

Commit bc620f0

Browse files
authored
fix: credentials: do not prompt the user multiple times at once (#249)
Signed-off-by: Grant Linville <[email protected]>
1 parent 624f9b7 commit bc620f0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/runner/runner.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type Runner struct {
6161
runtimeManager engine.RuntimeManager
6262
ports engine.Ports
6363
credCtx string
64+
credMutex sync.Mutex
6465
}
6566

6667
func New(client engine.Model, credCtx string, opts ...Options) (*Runner, error) {
@@ -71,6 +72,7 @@ func New(client engine.Model, credCtx string, opts ...Options) (*Runner, error)
7172
factory: opt.MonitorFactory,
7273
runtimeManager: opt.RuntimeManager,
7374
credCtx: credCtx,
75+
credMutex: sync.Mutex{},
7476
}
7577

7678
if opt.StartPort != 0 {
@@ -330,6 +332,10 @@ func recordStateMessage(state *engine.State) error {
330332
}
331333

332334
func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env []string) ([]string, error) {
335+
// Since credential tools (usually) prompt the user, we want to only run one at a time.
336+
r.credMutex.Lock()
337+
defer r.credMutex.Unlock()
338+
333339
c, err := config.ReadCLIConfig("")
334340
if err != nil {
335341
return nil, fmt.Errorf("failed to read CLI config: %w", err)

0 commit comments

Comments
 (0)