Skip to content

Commit 303a652

Browse files
ericcurtinCopilot
andauthored
Update cmd/cli/commands/run.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 40f5830 commit 303a652

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cmd/cli/commands/run.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,17 @@ func generateInteractiveBasic(cmd *cobra.Command, desktopClient *desktop.Client,
272272
sigChan := make(chan os.Signal, 1)
273273
signal.Notify(sigChan, syscall.SIGINT)
274274
go func() {
275-
<-sigChan
276-
cancelChat()
275+
select {
276+
case <-sigChan:
277+
cancelChat()
278+
case <-chatCtx.Done():
279+
}
277280
}()
278281

279282
err = chatWithMarkdownContext(chatCtx, cmd, desktopClient, backend, model, userInput, apiKey)
280283

281284
// Clean up signal handler
282285
signal.Stop(sigChan)
283-
close(sigChan)
284286
cancelChat()
285287

286288
if err != nil {

0 commit comments

Comments
 (0)