Skip to content

Commit 90b0173

Browse files
mirkoCrobumirkoCrobu
authored andcommitted
code review feedback
1 parent 40eca71 commit 90b0173

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

cmd/arduino-app-cli/app/restart.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ func restartHandler(ctx context.Context, cfg config.Configuration, app app.Ardui
7777
}
7878
}
7979

80-
// Feedback finale di successo
8180
outputResult := getResult()
8281
feedback.PrintResult(restartAppResult{
8382
AppName: app.Name,

internal/orchestrator/orchestrator.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,16 @@ func RestartApp(
451451
yield(StreamMessage{error: err})
452452
return
453453
}
454+
455+
if runningApp != nil && runningApp.FullPath.String() != appToStart.FullPath.String() {
456+
yield(StreamMessage{error: fmt.Errorf("another app %q is running", runningApp.Name)})
457+
return
458+
}
459+
454460
if runningApp != nil {
455461
stopStream := StopApp(ctx, *runningApp)
456462
for msg := range stopStream {
457463
if !yield(msg) {
458-
cancel()
459464
return
460465
}
461466
if msg.error != nil {
@@ -464,12 +469,7 @@ func RestartApp(
464469
}
465470
}
466471
startStream := StartApp(ctx, docker, provisioner, modelsIndex, bricksIndex, appToStart, cfg, staticStore)
467-
for msg := range startStream {
468-
if !yield(msg) {
469-
cancel()
470-
return
471-
}
472-
}
472+
startStream(yield)
473473
}
474474
}
475475

0 commit comments

Comments
 (0)